CoreFiles by mySites.guru
Dispatcher.php52 lines, 1,445 bytes, from Joomla_5.3.2-Stable-Full_Package.zip
Raw History Compare with 5.3.1
md5
7fcfc609515cdb67614d53663ebf24f5
sha1
8b2b64efeaabb414a12054cf1ae89c0d4339c55e
sha256
ec3990383cdc97cfcc9795a70bbbdc2bcfdda03e01e89cb9fd5df934e9142147
<?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 (str_starts_with($task, '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 94 releases, Joomla 5.3.0-beta1 to 6.2.1-rc1. See them all, or every version of this file.