CoreFiles by mySites.guru
Dispatcher.php53 lines, 1,256 bytes, from Joomla_4.0.0-Stable-Full_Package.zip
Raw History Compare with 3.10.12
md5
4583eca7ba9b433b9b3de85ea75580ab
sha1
9dfc9e268d8c12e3cd0bfc3560aeb13ed324822a
sha256
68b4c68c949cac358e9ce54869a149b99b80a0e3a35dc37e484e74851a5bf1e2
<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\Component\Config\Site\Dispatcher;

\defined('_JEXEC') or die;

use Joomla\CMS\Access\Exception\NotAllowed;
use Joomla\CMS\Dispatcher\ComponentDispatcher;

/**
 * ComponentDispatcher class for com_config
 *
 * @since  4.0.0
 */
class Dispatcher extends ComponentDispatcher
{
	/**
	 * Method to check component access permission
	 *
	 * @since   4.0.0
	 *
	 * @return  void
	 *
	 * @throws  Exception|NotAllowed
	 */
	protected function checkAccess()
	{
		parent::checkAccess();

		$task = $this->input->getCmd('task', 'display');
		$view = $this->input->get('view');
		$user = $this->app->getIdentity();

		if (substr($task, 0, 8) === 'modules.' || $view === 'modules')
		{
			if (!$user->authorise('module.edit.frontend', 'com_modules.module.' . $this->input->get('id')))
			{
				throw new NotAllowed($this->app->getLanguage()->_('JERROR_ALERTNOAUTHOR'), 403);
			}
		}
		elseif (!$user->authorise('core.admin'))
		{
			throw new NotAllowed($this->app->getLanguage()->_('JERROR_ALERTNOAUTHOR'), 403);
		}
	}
}

The same content is in 18 releases, Joomla 4.0.0-beta6 to 4.1.0-alpha3. See them all, or every version of this file.