问题描述
我安装了
运行迁移,创建了超级用户,复制了users.php到config /目录。
I installed CakeDC/usersrun migration, created the super user, copied the users.php to config/ directory.
现在在我的网站上,所有页面都重定向到登录页面。而且我无法更改此内容,因为我不太了解权限的工作原理。
And now in my website all pages are redirecting to login page. And i can't change this thing, cause i not well understand how permissions work.
我需要允许所有页面
My needs are to allow all pages on site, and block access only for one page with personal data for the user loggedin.
任何帮助,建议阅读的内容,示例值得欢迎,谢谢!
Any help, suggest readings, examples are welcome, BIG thanks!
推荐答案
您需要允许您的 beforeFilter
中的所有操作 AppController
。
You will need to allow all actions in the beforeFilter
of your AppController
.
public function beforeFilter(Event $event)
{
$this->Auth->allow();
}
请参见
然后,需要在具有该操作的控制器的 beforeFilter
中拒绝需要身份验证的操作。
You will then need to deny the action that requires authentication in the beforeFilter
of the controller that has that action.
public function beforeFilter(Event $event)
{
// Where `loggedInAction` is the name of the
// action that requires authentication
$this->Auth->deny('loggedInAction');
}
请参见
这篇关于CakeDc /用户如何使用权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!