- md5
- e0f9b1f2fd3846f6fdc77f9460e68ab6
- sha1
- 23ae63c4567860c99600230d0e3947b84ed96dce
- sha256
- 0ff77db5adfd24ca862136a7fdbcf5c37faeb5bda77d3ace6285192e2849d8a6
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
<?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\MVC\Controller\ApiController;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* The levels controller
*
* @since 4.0.0
*/
class LevelsController extends ApiController
{
/**
* The content type of the item.
*
* @var string
* @since 4.0.0
*/
protected $contentType = 'levels';
/**
* The default view for the display method.
*
* @var string
* @since 4.0.0
*/
protected $default_view = 'levels';
/**
* Method to allow extended classes to manipulate the data to be saved for an extension.
*
* @param array $data An array of input data.
*
* @return array
*
* @since 6.1.2
*/
protected function preprocessSaveData(array $data): array
{
if ($this->input->getMethod() === 'PATCH') {
$data['rules'] = json_decode($data['rules'], true);
}
return $data;
}
/**
* Method to check if it's allowed to delete a record
*
* @return boolean
*
* @since 6.1.4
*/
protected function allowDelete(): bool
{
// 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 add a new record.
*
* @param array $data An array of input data.
*
* @return boolean
*
* @since 6.1.4
*/
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 6.1.4
*/
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);
}
}
No other release has this exact content. See every version of this file.