ACL - 在哪里配置自定义userModel的授权? [英] ACL - Where to configure custom userModel for authorize?
问题描述
我有Auth的 Player
而不是默认的 User
模型。
我最近为我的应用程序配置ACL,并尝试通过返回false 在我的
isAuthorized($ player)
函数,发生以下错误:
I'm having Player
instead of default User
model for my Auth.
I recently configured ACL for my app and while trying to do testing by return false
in my isAuthorized($player)
function, the following error occured:
AclNode::node() - Couldn't find Aro node identified by
Array ( [Aro0.model] => User [Aro0.foreign_key] => 1 )
Aro0.model
不是玩家
吗?我找不到要更改 Auth-> authorize
的位置。 Auth-authenticate
工作正常,因为我管理登录,因为有一个 userModel
选项允许我指定一个自定义模型用户登录。
Isn't the Aro0.model
suppose to be Player
? I can't find where to change for Auth->authorize
. Auth-authenticate
works fine as I manage to login since there is a userModel
option allow me to specify a custom Model for user login.
这是我的AppController
Here's My AppController
class AppController extends Controller
{
public $components = array(
'Session',
'Acl',
'RequestHandler',
'Auth' => array(
'authorize' => array(
'controller',
'Actions' => array('actionPath' => 'controllers'),
),
'authenticate' => array(
'Form' => array(
'userModel' => 'Player',
'fields' => array('username' => 'email', 'password' => 'password'),
)
)
),
);
public $helpers = array('Html', 'Form', 'Session');
function isAuthorized($player)
{
//var_dump($player); die;
return false;
return $this->Auth->loggedIn();
}
}
推荐答案
解决。它是将 userModel
与 actionPath
一起附加。
Solved. it is to append userModel
together with actionPath
.
$this->Auth->authorize = array(
AuthComponent::ALL => array('actionPath' => 'controllers/', 'userModel' => 'Player'),
'Actions',
'Controller'
);
这篇关于ACL - 在哪里配置自定义userModel的授权?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!