CoreFiles by mySites.guru
Dispatcher.php60 lines, 1,498 bytes, from Joomla_4.0.0-beta4-Beta-Full_Package.zip
Raw History Compare with 4.0.0-beta3
md5
b562237e65bbcce0f0a4bdc9e7b38c72
sha1
db7cfba46c8950799791970d064dac181ee94b06
sha256
3712285885d89f78b1f344adba87da90282a9549a29269ab807396b431b382b1
<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_associations
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\Component\Associations\Administrator\Dispatcher;

\defined('_JEXEC') or die;

use Joomla\CMS\Access\Exception\NotAllowed;
use Joomla\CMS\Dispatcher\ComponentDispatcher;
use Joomla\CMS\Language\Text;
use Joomla\Component\Associations\Administrator\Helper\AssociationsHelper;

/**
 * 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 !== '')
		{
			list($extensionName, $typeName) = explode('.', $itemType);

			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 same content is in 4 releases, Joomla 4.0.0-beta2 to 4.0.0-beta5. See them all, or every version of this file.