Skip to content

Instantly share code, notes, and snippets.

@marcincodes
Created February 9, 2014 19:18
Show Gist options
  • Save marcincodes/8904554 to your computer and use it in GitHub Desktop.
Save marcincodes/8904554 to your computer and use it in GitHub Desktop.
public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('initDB'); // We can remove this line after we're finished
}
public function initDB() {
$group = $this->User->Group;
// Allow admins to everything
$group->id = 1;
$this->Acl->allow($group, 'controllers');
// allow users to only add and edit on posts and widgets
$group->id = 3;
$this->Acl->deny($group, 'controllers');
// allow basic users to log out
$this->Acl->allow($group, 'controllers/users/logout');
// we add an exit to avoid an ugly "missing views" error message
echo "all done";
exit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment