Files
dbois/application/controllers/beheer/AuthorisationController.php
T
2018-07-29 10:11:02 +02:00

51 lines
1020 B
PHP

<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 20/06/2018
* Time: 14:16
*/
class AuthorisationController extends MY_Controller {
public function __construct()
{
parent::__construct();
if( AUTHENTICATED == FALSE ) die('NO ACCES');
$models = [];
$libraries = [];
$this->load->model( $models );
$this->load->library( $libraries );
}
public function index()
{
}
public function getRoleAuthorisations()
{
$roleAuthorisations = Role::getPagesAccessByRole();
$this->json( $roleAuthorisations );
}
public function toggleAuhorisation()
{
$pageID = $this->clean_input( 'pageID' );
$roleLevel = $this->clean_input( 'roleLevel' );
$access = $this->clean_input( 'access' );
$page = Page::find( $pageID );
if ( $access == 'F' ) $roleLevel = - $roleLevel;
$page->pagelevel = $page->pagelevel + $roleLevel;
$page->save();
}
}