Created
June 3, 2015 14:50
-
-
Save erikfig/7c5e5a65fd5b1fdef42a to your computer and use it in GitHub Desktop.
CakePHP 3 proibir acesso a administração
This file contains 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
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