Just get the role and apply it?

if( $this->Auth->user('User.role') > 1 )  {   // is admin
   $this->Auth->allow( array('secretController' =>
'superSecureAction' ) );
}

On Aug 6, 1:12 pm, "Mariano C." <mariano.calan...@gmail.com> wrote:
> I have users table, with field id, username, password and role.
> role is a numeric value: 0 banned users, 1 registered users, 2 admins.
>
> I've coded AppController like:
> class AppController extends Controller {
>         var $components = array('Auth');
>
>         function beforeFilter()
>         {
>                 $this->Auth->allow(array('users' => 'register'));
>         }
>
> }
>
> So every user can reach registration page.
> Now I would that for user with different role will be allowed
> different action. How can I handle this just inside the AppController?

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to