Last active
August 29, 2015 13:57
-
-
Save jaggy/9654877 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Set up the application permissions | |
* | |
* @http_request(GET, /setup) | |
* @return void | |
*/ | |
public function setup() | |
{ | |
$development_mode = Configure::read('debug') > 0; | |
$role = $this->User->Role; | |
$role->id = 1; | |
$this->Acl->allow( $role, 'controllers' ); | |
// Allow everything in development | |
if( $development_mode ){ | |
$roles = $role->find( 'all', ['fields' => 'id'] ); | |
foreach($roles as $key => $value){ | |
// set the role id | |
$role->id = $value[ 'Role' ][ 'id' ]; | |
// allow to every where | |
$this->Acl->allow($role, 'controllers'); | |
} | |
} | |
echo "Generated permissions\n"; | |
exit; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment