Quantcast
Channel: cakephp isAuthorized() not being called - Stack Overflow
Viewing all articles
Browse latest Browse all 4

cakephp isAuthorized() not being called

$
0
0

I am trying to use the isAuthorized() method to do a check for an admin flag, but the function never seems to be called. Even when I set the function to always return false, it allows any user. It just seems like it isn't being called.

Do I need to do something more than setting $this->Auth->authorize = 'controller' ?

from /app/app_controller.php

class AppController extends Controller{var $components = array('Auth');function beforeFilter(){    $this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');    $this->Auth->loginRedirect = array('controller' => 'pages', 'display' => 'home');    $this->Auth->logoutRedirect = '/';    $this->Auth->authorize = 'controller';    $this->Auth->userScope = array('User.active' => 1);}function isAuthorized(){    if (strpos($this->action, "admin_") != false)    {        if ($this->Auth->user('isAdmin') == '0')        {            return false;        }    }    return true;}}

Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>