Skip to content

Instantly share code, notes, and snippets.

@jaggy
Last active August 29, 2015 13:57
Show Gist options
  • Save jaggy/9654877 to your computer and use it in GitHub Desktop.
Save jaggy/9654877 to your computer and use it in GitHub Desktop.
<?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