Ok, nobody answers...
So, one error I've made is to call AuthComponent before AclComponent
in $components array !
And another error is to not authorize an action called by a
requestAction()...
Hope this help!
On 10 sep, 14:13, avairet <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm trying to use Auth Component and Acl Component and Acl Behavior
> like that:
>
> 1) App_controller:
>
> public $components('Auth','Acl');
>
> public beforeFilter() {
> $this->Auth->userModel = 'User';
> $this->Auth->fields = array('username' => 'pseudo', 'password' =>
> 'password');
> $this->Auth->loginAction = 'users/login';
> $this->Auth->loginRedirect = 'profil/mes-infos';
> $this->Auth->logoutRedirect = '/';
> $this->Auth->authorize = 'actions';
> $this->Auth->loginError = __('Identifiant ou mot de passe
> incorrect.', true);
> $this->Auth->authError = __('Vous n\'avez pas accès à cette page.
> Veuillez vous identifier.', true);
> $this->Auth->autoRedirect = true;
>
> }
>
> 2) App_model:
>
> public $actsAs = array (
> 'Acl' => array('type' => 'controlled'),
> 'Containable' => array(true,'notices' => true)
> );
>
> public function parentNode() {
> return null;
>
> }
>
> 3) User model:
>
> public $actsAs = array (
> 'Acl' => array('type'=>'requester'),
> 'Containable' => array(true,'notices' => true)
>
> }
>
> public function parentNode() {
> if (!$this->id && empty($this->data)) {
> return null;
> }
> $data = $this->data;
> if (empty($this->data)) {
> $data = $this->read();
> }
> if (!$data['User']['group_id']) {
> return null;
> } else {
> return array('Group' => array('id' => $data['User']
> ['group_id']));
> }
>
> }
>
> 4) Group model:
>
> public $actsAs = array (
> 'Acl' => array('type'=>'requester'),
> 'Containable' => array(true,'notices' => true)
> );
>
> public function parentNode() {
> if (!$this->id && empty($this->data)) {
> return null;
> }
> $data = $this->data;
> if (empty($this->data)) {
> $data = $this->read();
> }
> if (!$data['Group']['id']) {
> return null;
> } else {
> return array('Group' => array('id' => $data['Group']['id']));
> }
>
> }
>
> 5) ExpertsController:
>
> public function beforeFilter() {
> parent::beforeFilter();
> $this->Auth->allowedActions = array('index');
>
> }
>
> public function index() {}
>
> So when I request "http://www.mywebsite/experts", I can't access to
> index() view, there is a infinite loop??!
> And if I request a protected action (e.g. "http://www.mywebsite/
> experts/add", I'm never redirected to login page, there is a infinite
> loop too??!
>
> Do I something wrong in this basic usage of Auth + Acl?
>
> Thank's by advance for any suggestions!
>
> BR
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---