- md5
- f797090537f223cf04c3cb97a186409a
- sha1
- 5e564cadc613acd34b21659588d90336edc31b02
- sha256
- 209fc5ac8dd90128e5481fde0fe00ef943042700c82cb8bf269dee5933dd1ce4
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
<?php
/**
* @package Joomla.API
* @subpackage com_users
*
* @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\Users\Api\Controller;
use Joomla\CMS\Access\Exception\NotAllowed;
use Joomla\CMS\MVC\Controller\ApiController;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* The groups controller
*
* @since 4.0.0
*/
class GroupsController extends ApiController
{
/**
* The content type of the item.
*
* @var string
* @since 4.0.0
*/
protected $contentType = 'groups';
/**
* The default view for the display method.
*
* @var string
* @since 3.0
*/
protected $default_view = 'groups';
/**
* Removes an item.
*
* @param integer $id The primary key to delete item.
*
* @return void
*
* @since 5.4.6
*/
public function delete($id = null)
{
if (!$this->app->getIdentity()->authorise('core.admin', $this->option)) {
throw new NotAllowed('JLIB_APPLICATION_ERROR_DELETE_NOT_PERMITTED', 403);
}
parent::delete($id);
}
/**
* Method to check if you can add a new record.
*
* @param array $data An array of input data.
*
* @return boolean
*
* @since 5.4.6
*/
protected function allowAdd($data = [])
{
// Overrides the default behavior to check the core.admin permission.
return $this->app->getIdentity()->authorise('core.admin', $this->option);
}
/**
* Method to check if you can edit an existing record.
*
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key; default is id.
*
* @return boolean
*
* @since 5.4.6
*/
protected function allowEdit($data = [], $key = 'id')
{
// Overrides the default behavior to check the core.admin permission.
return $this->app->getIdentity()->authorise('core.admin', $this->option);
}
}
The same content is in 3 releases, Joomla 5.4.9 to 5.4.10. See them all, or every version of this file.