CoreFiles by mySites.guru
Dispatcher.php47 lines, 1,321 bytes, from Joomla_4.2.0-beta3-Beta-Full_Package.zip
Raw History Compare with 4.2.0-beta2
md5
524da44dd76d6384e7e02b3d5ae991d3
sha1
77df16894b7cc6b384937697e694ab52b8a72b67
sha256
7dba9906963426977271230d3161384b9e67b98eb9f45588111d6c0e86ec177a
<?php

/**
 * @package     Joomla.Administrator
 * @subpackage  com_media
 *
 * @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\Media\Administrator\Dispatcher;

use Joomla\CMS\Access\Exception\NotAllowed;
use Joomla\CMS\Dispatcher\ComponentDispatcher;

/**
 * ComponentDispatcher class for com_media
 *
 * @since  4.0.0
 */
class Dispatcher extends ComponentDispatcher
{
    /**
     * Method to check component access permission
     *
     * @since   4.0.0
     *
     * @return  void
     */
    protected function checkAccess()
    {
        $user   = $this->app->getIdentity();
        $asset  = $this->input->get('asset');
        $author = $this->input->get('author');

        // Access check
        if (
            !$user->authorise('core.manage', 'com_media')
            && (!$asset || (!$user->authorise('core.edit', $asset)
            && !$user->authorise('core.create', $asset)
            && count($user->getAuthorisedCategories($asset, 'core.create')) == 0)
            && !($user->id == $author && $user->authorise('core.edit.own', $asset)))
        ) {
            throw new NotAllowed($this->app->getLanguage()->_('JERROR_ALERTNOAUTHOR'), 403);
        }
    }
}

The same content is in 5 releases, Joomla 4.2.0-beta3 to 4.2.1-rc2. See them all, or every version of this file.