Skip to content

Instantly share code, notes, and snippets.

@erikfig
Created June 3, 2015 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erikfig/7c5e5a65fd5b1fdef42a to your computer and use it in GitHub Desktop.
Save erikfig/7c5e5a65fd5b1fdef42a to your computer and use it in GitHub Desktop.
CakePHP 3 proibir acesso a administração
public function beforeFilter(Event $event)
{
$user = $this->Auth->user();
$params = $this->request->params;
if ($user['admin'] != 1 and isset($params['prefix']) and $params['prefix'] == 'admin')
throw new ForbiddenException('Você não tem permissão');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment