- md5
- ca2ede5ec561d78e204e2cbd7c883794
- sha1
- 3154774d5f7e2df64b233ba65f1387f660650592
- sha256
- 9d420a844c918d81b719921618357a501ca6526448defb07126e24c5d558fa06
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
<?php
/**
* @package Joomla.Administrator
* @subpackage com_associations
*
* @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\Associations\Administrator\Dispatcher;
use Joomla\CMS\Access\Exception\NotAllowed;
use Joomla\CMS\Dispatcher\ComponentDispatcher;
use Joomla\CMS\Language\Text;
use Joomla\Component\Associations\Administrator\Helper\AssociationsHelper;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* ComponentDispatcher class for com_associations
*
* @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();
// Check if user has permission to access the component item type.
$itemType = $this->input->get('itemtype', '', 'string');
if ($itemType !== '') {
[$extensionName, $typeName] = array_pad(explode('.', $itemType, 2), 2, '');
if (!AssociationsHelper::hasSupport($extensionName)) {
throw new \Exception(
Text::sprintf('COM_ASSOCIATIONS_COMPONENT_NOT_SUPPORTED', $this->app->getLanguage()->_($extensionName)),
404
);
}
if (!$this->app->getIdentity()->authorise('core.manage', $extensionName)) {
throw new NotAllowed($this->app->getLanguage()->_('JERROR_ALERTNOAUTHOR'), 403);
}
// The item type has to be one that the extension declares, the views and fields build queries and markup from it.
if (!\in_array($typeName, AssociationsHelper::getExtensionHelper($extensionName)->getItemTypes(), true)) {
throw new \Exception($this->app->getLanguage()->_('JGLOBAL_RESOURCE_NOT_FOUND'), 404);
}
}
}
}
The same content is in 3 releases, Joomla 5.4.11 to 6.3.0-alpha1. See them all, or every version of this file.