cerebrate/src/Controller/RolesController.php

64 lines
1.7 KiB
PHP

<?php
namespace App\Controller;
use App\Controller\AppController;
use Cake\Utility\Hash;
use Cake\Utility\Text;
use \Cake\Database\Expression\QueryExpression;
use Cake\Http\Exception\NotFoundException;
use Cake\Http\Exception\MethodNotAllowedException;
use Cake\Http\Exception\ForbiddenException;
class RolesController extends AppController
{
public function index()
{
$this->CRUD->index([
'filters' => ['name', 'uuid', 'perm_admin'],
'quickFilters' => ['name']
]);
if ($this->ParamHandler->isRest()) {
return $this->restResponsePayload;
}
$this->set('metaGroup', $this->isAdmin ? 'Administration' : 'Cerebrate');
}
public function add()
{
$this->CRUD->add();
if ($this->ParamHandler->isRest()) {
return $this->restResponsePayload;
}
$this->set('metaGroup', $this->isAdmin ? 'Administration' : 'Cerebrate');
}
public function view($id)
{
$this->CRUD->view($id);
if ($this->ParamHandler->isRest()) {
return $this->restResponsePayload;
}
$this->set('metaGroup', $this->isAdmin ? 'Administration' : 'Cerebrate');
}
public function edit($id)
{
$this->CRUD->edit($id);
if ($this->ParamHandler->isRest()) {
return $this->restResponsePayload;
}
$this->set('metaGroup', $this->isAdmin ? 'Administration' : 'Cerebrate');
$this->render('add');
}
public function delete($id)
{
$this->CRUD->delete($id);
if ($this->ParamHandler->isRest()) {
return $this->restResponsePayload;
}
$this->set('metaGroup', $this->isAdmin ? 'Administration' : 'Cerebrate');
}
}