CoreFiles by mySites.guru
Dispatcher.php50 lines, 1,267 bytes, from Joomla_4.0.0-alpha12-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha11
md5
4273b387aadfcf099e7d7c121be3704d
sha1
f4433baa5785e6031d73dd3afe944b4e2c094cc0
sha256
01a83e698167b8115ab833e5e04bcf7a1b4ae5e5a91cb389b50f2ff3f4ef576b
<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_fields
 *
 * @copyright   Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\Component\Fields\Site\Dispatcher;

defined('_JEXEC') or die;

use Joomla\CMS\Access\Exception\NotAllowed;
use Joomla\CMS\Dispatcher\ComponentDispatcher;
use Joomla\Component\Fields\Administrator\Helper\FieldsHelper;

/**
 * ComponentDispatcher class for com_fields
 *
 * @since  4.0.0
 */
class Dispatcher extends ComponentDispatcher
{
	/**
	 * Method to check component access permission
	 *
	 * @return  void
	 *
	 * @since   4.0.0
	 */
	protected function checkAccess()
	{
		parent::checkAccess();

		if ($this->input->get('view') !== 'fields' || $this->input->get('layout') !== 'modal')
		{
			return;
		}

		$context = $this->app->getUserStateFromRequest('com_fields.fields.context', 'context', 'com_content.article', 'CMD');
		$parts   = FieldsHelper::extract($context);

		if (!$this->app->getIdentity()->authorise('core.create', $parts[0])
			|| !$this->app->getIdentity()->authorise('core.edit', $parts[0]))
		{
			throw new NotAllowed($this->app->getLanguage()->_('JERROR_ALERTNOAUTHOR'));
		}
	}
}

The same content is in 6 releases, Joomla 4.0.0-alpha7 to 4.0.0-alpha12. See them all, or every version of this file.