CoreFiles by mySites.guru
Dispatcher.php52 lines, 1,445 bytes, from Joomla_4.2.4-Stable-Full_Package.zip
Raw History Compare with 4.2.3
md5
39dae63cc593eda2eb21d07917a65a2b
sha1
54c1637720ab5deff1b589df079dab29399bd6ed
sha256
47db64bf99652590689a746a8a39a02a443274e479681c08a4669e80a8015d67
<?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;

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

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
 * 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 131 releases, Joomla 4.2.1 to 5.3.0-alpha3. See them all, or every version of this file.