脚本宝典收集整理的这篇文章主要介绍了CakePHP Acl自动检查,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
function beforeFilter() { // ACL Check if($this->name != 'Pages' && !$this->Acl->check(array('model' => 'User','foreign_key' => $this->Session->read('Auth.User.id')),$this->name . '/' . $this->params['action'])) { CakeLOG::wrITe('auth','ACL DENY: ' . $this->Session->read('Auth.User.name') . ' tried to access ' . $this->name . '/' . $this->params['action'] . '.'); $this->render('/pages/forbidden'); exit; // Make sure we halt here,otherwise the forbidden message is just shown above the content. } }
除了“页面”控制器之外,所有控制器/操作都经过ACL检查,如果用户没有访问权限,则会提供“pages / forbidden”视图,并且还会将日志条目写入auth.log文件(可选),但我当时更喜欢这个).
以上是脚本宝典为你收集整理的CakePHP Acl自动检查全部内容,希望文章能够帮你解决CakePHP Acl自动检查所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。