简体   繁体   中英

Cakephp 1.3, router and authentication problem

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM