CoreFiles by mySites.guru
Dispatcher.php60 lines, 1,497 bytes, from Joomla_4.0.0-alpha6-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha5
md5
a809fe2ab29d8120ed5b6c7f3236fbbc
sha1
6753ea0055d940e0634e0a067c707a4d8cef4fec
sha256
dbdfbc23f748718497a8f911377a3f1226b35384436c95b4d5ad8e47011ea97d
<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_associations
 *
 * @copyright   Copyright (C) 2005 - 2018 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 2 releases, Joomla 4.0.0-alpha5 to 4.0.0-alpha6. See them all, or every version of this file.