default)
BUT 4 the user I would like to allow him just command/index & command/
add actions 4 example !!
Got it, I think I have to write some logic or so in the login
action !!!
Enjoy , AB
On 17 juin, 17:19, John Andersen <j.andersen...@gmail.com> wrote:
> Please provide more information!
> How is it not working? What is your expected result and what are you
> getting?
> Enjoy,
> John
>
> On Jun 17, 3:53 pm, Abraham Boray <abrahambo...@gmail.com> wrote:
>
> > Guys, I've been working on a project that's required authentication !
> > I set up the system it's working perfectly, still I have a problem.
>
> > My system got Two roles, USER & ADMIN
>
> > 4 the admin It's okay, he got the full access after login in.
> > But 4 the user I want to restrict Some actions and allow just few,
> > like "Commands/index", "Commands/edit" and finally "Commands/
> > delete".
>
> > I already write the code 4 this part , but it's not working ;(
>
> > ///THE LOGIN ACTION
> > function login(){
> > $this->layout = 'login';
>
> > $authenticatedUser=$this->Session->read('Auth.User');
> > if(!empty($authenticatedUser)){
> > if($authenticatedUser['role']==1){ //1 means it's an ADMIN , 0 for a
> > simple USER
> > //$this->Auth->allow('*');
> > $this->redirect('/admin/commands');
> > }else{
> > $this->Auth->allow(array('controller'=>'commands','action'=>'index'));
>
> > $this->redirect('/commands');
> > }
> > }//End IF !EMPTY
>
> > /// THE BEFOREFILTER ACTION
> > function beforeFilter() {
> > //$this->redirect(array('action' => 'student_login'));
> > //Configure AuthComponent
> > $this->Auth->fields =
> > array('username'=>'email','password'=>'password');
> > $this->Auth->loginAction = array('controller' => 'users',
> > 'action' => 'login');
> > $this->Auth->logoutRedirect = array('controller' => 'users',
> > 'action' => 'login');
> > $this->Auth->loginError = 'Login impossible, E-mail ou Mot de
> > passe est incorrect!';
> > $this->Auth->loginRedirect = array('controller' => 'commands',
> > 'action' => 'index');
> > $this->Auth->authError = 'Vous n\'avez pas de droits pour acceder a
> > cette section!';
> > $this->Auth->autoRedirect=false;
> > $this->Auth->deny('*');
> > }
>
> > Reagards, AbrahamBoray ;)
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
No comments:
Post a Comment