Christoph ha scritto:

> I'm having a bit of difficulty fully setting this component up.  I've
> seen the wiki, I've seen (what little) documentation on the cakeforge
> site and it does a good job of showing the login() action. However,
> nothing I've seen describes how to limit access to other actions.  If I
> have the roles of, say, 'Admin', 'Moderator', 'User', 'Anon', how can I
> make it so that one action is accessable by Anon+ and another
> accessable by Moderator+?
In your Controller:
var $access = array('index'=>array('role'=>'Moderator'),
'add'=>array('role'=>'Admin'));

in your beforeFilter:
if (!$this->rdSimpleAuth->check($this->action, $this->access))
{
      $this->redirect('/users/login');
      exit;
}

I often in beforeFilter write this:
if(eregi(CAKE_ADMIN,$this->action))
{
     $this->access[$this->action] = array('role'=>'Admin');
}
for lock admin actions.

Hope this can help you :)


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Cake PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to