Wednesday, November 2, 2011

AuthComponent - Multiple Setups

I'm using the AuthComponent to control the access to two prefixes: "admin" and "student".

I'm changing the AuthComponent configuration (model, fields, userScope, loginAction and even sessionKey) on AppController::beforeFilter() but once i'm logged with one user Model at "admin', AuthComponent says i'm authenticated to access the other prefix, with another configuration.

You can see my beforeFilter here: https://gist.github.com/1334862

As you can see on my code, there's a commented line on the Student prefix configuration (called "aluno" on my code):

$this->Auth->authorize = array('Controller');

This was my ugly workaround to redirect the Admin to the Student login screen if I can't find a student with the logged user data (name, email and etc.)

Mind that I have two user models (not two user roles): User and Student, with different data and fields.

This used to work back in the 1.3 days...

Thanks,
--
Thiago Belem
Desenvolvedor
Rio de Janeiro - RJ - Brasil

+55 (21) 8865.9250
thiagobelem.net
contato@thiagobelem.net

Skype / gTalk » thiago.belem.web
LinkedIn » br.linkedin.com/in/thiagobelem/pt
Assando Sites
, curso de CakePHP » assando-sites.com.br

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: