2012-09-10 2 views
1

인스턴트 메시징 http://book.cakephp.org/2.0/en/tutorials-and-examples/simple-acl-controlled-application/simple-acl-controlled-application.html < ---이 튜토리얼과 추측은 어떻게 되나요?)가 나던 작업, 메신저 사용 CakePHP의 2.2.2 ... 난 다음 오류 얻을cakephp 2.2 Acl 작동하지 않음 (그룹)

Undefined index: id [CORE/Cake/Model/AclNode.php, line 140]

AclNode::node() - Couldn't find Aro node identified by "Array ([Aro0.model] => User [Aro0.foreign_key] =>) " Error: An Internal Error Has Occurred.

이 오류가 난이 기능에

public function bindNode($user) { 
      return array('model' => 'Groups', 'foreign_key' => $user['Users']['groups_id']); 
     } 

그래서 내 사용자 모델에서 내 GROUP_ID을 얻을 해달라고 렸기 때문에입니다 $ 사용자 VAR는

답변

1

모델 이름은 단수해야합니다 ... 단지 사용자 이름과 암호를 ...없이 GROUP_ID의

도와주세요 사람이 포함되어 있습니다.

'model' => 'Group' 
$user['Users']['group_id'] //in your DB, put "group_id" to, not "groups_id" 

만든 모델이 "그룹"인지 확인하십시오. :)

0

방금이 문제가 발생했습니다. 코드를 추적 해 보면 내 모델이 'AdminUser'이고 기본값 인 'User'가 아니라는 것이 었습니다. userModel 설정을 변경하면 나를 위해 해결되었습니다.

public $components = array(
    'Acl', 
    'Auth' => array(
     'authorize' => array(
      'Actions' => array(
       'actionPath' => 'controllers', 
       'userModel' => 'AdminUser' 
      ) 
     ) 
    ), 
    'Session' 
); 

은 bindNode 방법을 보면 그것은 당신이 오히려 너무 트릭을 할 수있는 '사용자'에 userModel 설정 '사용자'보다 '사용자'라는 이름의 모델을 사용하는 것 같습니다. 나는 희망이 도움이

,
피트