Bonjour,
j'ai suivit le tutoriel sur les acl de se site [url=http://www.formation-cakephp.com/32/gestion-des-droits-dacces-par-groupes-dutilisateurs-avec-acl]ici[/url]
Tous se passe bien, la l'initialisation des acro fonctionne correctement.
Sais quand je me connecter avec mes identifiants que j'ai un problème sa me renvoi sa :
Warning (512): AclNode::node() - Couldn't find Aro node identified by "Array
(
[Aro0.model] => User
[Aro0.foreign_key] => 1
)
" [CORE\cake\libs\model\db_acl.php, line 191]
Warning (512): DbAcl::check() - Failed ARO/ACO node lookup in permissions check. Node references:
Aro: Array
(
[User] => Array
(
[id] => 1
[group_id] => 1
[username] => admin
[disabled] => 0
[created] => 2011-04-16 19:17:31
)
)
Aco: Posts/admin_index [CORE\cake\libs\controller\components\acl.php, line 238]
Warning (2): Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\anipassion\cake\libs\debugger.php:503) [CORE\cake\libs\controller\controller.php, line 646]
voila me code :
Group.php:
[code]<?php
class Group extends AppModel{
var $name = 'Group';
var $actsAs = array('Acl');
var $hasMany = "User";
function parentNode(){
if(!$this->id){
return null;
}
$data = $this->read();
if(!$data['Group']['parent_id']){
return null;
}
return array(
'model' => 'Group',
'foreign_key' => $data['Group']['parent_id']
);
}
}
?>[/code]
user.php:
[code]<?php
class User extends AppModel{
var $name = 'User';
var $actsAs = array('Acl');
var $belongsTo = 'Group';
function parentNode(){
return null;
}
function binNode($object){
return array(
'model' => 'Group',
'foreign_key' => $object['User']['group_id']
);
}
}
?>[/code]
Users_controller.php
[code]<?php
class UsersController extends AppController{
var $name = 'Users';
var $belongsTo = 'Post';
function login(){
}
function register(){
if(!empty($this->data)){
$this->save($this->data);
}
}
function logout(){
}
}
?>[/code]
app_controller.php :
[code]<?php
class AppController extends Controller
{
var $helpers = array ('Html', 'Text', 'Form','Javascript');
var $components = array('Acl','Auth');
function beforeFilter()
{
if(isset($this->Auth))
{
$this->Auth->userModel = 'User';
$this->Auth->userScope = array('User.disabled' => 0);
$this->Auth->loginAction = '/users/login';
$this->Auth->loginRedirect = '/admin/users/menu';
$this->Auth->logoutRedirect = '/';
$this->Auth->loginError = "Identifiant ou mot de passe incorrects.";
$this->Auth->authError = "Vous n'avez pas accès à cette page.";
$this->Auth->autoRedirect = true;
$this->Auth->authorize = 'actions';
if((empty($this->params['prefix']) || $this->params['prefix'] != 'admin') && $this->action != 'login')
{
$this->Auth->allow();
}
}
}
function beforeRender()
{
if(isset($this->params['prefix']) && $this->params['prefix'] == 'admin')
{
$this->layout = 'admin';
}
}
}
?>[/code]
Voila merci de vos réponse