0
我想用CakeDc用戶插件實現一個僅限組的acl。我遵循蛋糕的「簡單的Acl控制器應用指南」。 我有以下的用戶模型:CakeDc:用戶插件僅限組acl
public $belongsTo = array(
'Role' => array(
'className' => 'Role',
'foreignKey' => 'role_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);
public $actsAs = array('Acl' => array('type' => 'requester', 'enabled' => false));
public function parentNode() {
if (!$this->id && empty($this->data)) {
return null;
}
if (isset($this->data['User']['role_id'])) {
$roleId = $this->data['User']['role_id'];
} else {
$roleId = $this->field('role_id');
}
if (!$roleId) {
return null;
} else {
return array('Role' => array('id' => $roleId));
}
}
public function bindNode($user) {
return array('model' => 'Model.Role', 'foreign_key' => $user['User']['role_id']);
}
而且我有這個的榜樣:
public $actsAs = array('Acl' => array('type' => 'requester'));
public function parentNode() {
return null;
}
public $hasMany = array(
'User' => array(
'className' => 'User',
'foreignKey' => 'role_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
)
);
我似乎並不奏效,但它仍然問我的ARO。
AclNode::node() - Couldn't find Aro node identified by "Array ([Aro0.model] => User [Aro0.foreign_key] => 51) "
我該如何糾正這個錯誤? 在此先感謝。