CoreFiles by mySites.guru
Dispatcher.php53 lines, 1,385 bytes, from Joomla_5.4.11-Stable-Full_Package.zip
Raw History Compare with 5.4.10
md5
f703a62891e72950090c084d47a3416f
sha1
787246348296aeacc7773452e0c824abb7703c1f
sha256
5ded48d299c3fa2b3422b07d325417302a1cf35f244fc3181b6b668f1631418f
<?php

/**
 * @package     Joomla.Api
 * @subpackage  com_config
 *
 * @copyright   (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\Component\Config\Api\Dispatcher;

use Joomla\CMS\Access\Exception\NotAllowed;
use Joomla\CMS\Dispatcher\ApiDispatcher;
use Joomla\Component\Config\Administrator\Helper\ConfigHelper;

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

/**
 * ComponentDispatcher class for com_config
 *
 * @since  5.4.11
 */
class Dispatcher extends ApiDispatcher
{
    /**
     * Check if the user have the right access to the component config
     *
     * @return  void
     *
     * @since  5.4.11
     *
     * @throws  \Exception
     */
    protected function checkAccess(): void
    {
        $component  = $this->input->getCmd('component_name');
        $controller = $this->input->getCmd('controller');

        // Check the user has permission to access this component
        if ($controller === 'component' && ConfigHelper::canChangeComponentConfig($component)) {
            return;
        }

        if ($this->app->getIdentity()->authorise('core.admin')) {
            return;
        }

        throw new NotAllowed($this->app->getLanguage()->_('JERROR_ALERTNOAUTHOR'), 403);
    }
}

No other release has this exact content. See every version of this file.