[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/components/com_config/src/Dispatcher/ -> Dispatcher.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  com_config
   6   *
   7   * @copyright   (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  namespace Joomla\Component\Config\Site\Dispatcher;
  12  
  13  use Joomla\CMS\Access\Exception\NotAllowed;
  14  use Joomla\CMS\Dispatcher\ComponentDispatcher;
  15  
  16  // phpcs:disable PSR1.Files.SideEffects
  17  \defined('_JEXEC') or die;
  18  // phpcs:enable PSR1.Files.SideEffects
  19  
  20  /**
  21   * ComponentDispatcher class for com_config
  22   *
  23   * @since  4.0.0
  24   */
  25  class Dispatcher extends ComponentDispatcher
  26  {
  27      /**
  28       * Method to check component access permission
  29       *
  30       * @since   4.0.0
  31       *
  32       * @return  void
  33       *
  34       * @throws  \Exception|NotAllowed
  35       */
  36      protected function checkAccess()
  37      {
  38          parent::checkAccess();
  39  
  40          $task = $this->input->getCmd('task', 'display');
  41          $view = $this->input->get('view');
  42          $user = $this->app->getIdentity();
  43  
  44          if (substr($task, 0, 8) === 'modules.' || $view === 'modules') {
  45              if (!$user->authorise('module.edit.frontend', 'com_modules.module.' . $this->input->get('id'))) {
  46                  throw new NotAllowed($this->app->getLanguage()->_('JERROR_ALERTNOAUTHOR'), 403);
  47              }
  48          } elseif (!$user->authorise('core.admin')) {
  49              throw new NotAllowed($this->app->getLanguage()->_('JERROR_ALERTNOAUTHOR'), 403);
  50          }
  51      }
  52  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer