views:

519

answers:

1

Trying to implements simple privileges for admin user. Don't need huge acl rules and groups system. There are admin users, overs - just registered users. They can't access actions with admin prefix. So It was implemented in cakephp1.2 version with following code in app_controller:

function isAuthorized() {
    if (isset($this->params[Configure::read('Routing.admin')])) {
    if ($this->Auth->user('admin') != 1) {
        return false;
    }
    }
    return true;
}

But in 1.3 Routing.admin had been deprecated. How to rewrite it for use with 1.3 framework? Need some help.

+1  A: 

Well you could either write your own value into the config with configure::write() or catch it yourself using,

$this->params['admin'] 

Or whatever your admin route is called

DavidYell
$this->params['admin'] works fine! Thanks, David!
Zhlobopotam