class AppController extends Controller {

        var $components = array('Auth');

        function beforeFilter()
    {
                $this->Auth->allow('*');
            $this->Auth->deny('delete','add','edit');

           // check if we're using the pages controller
                if ($this->name == 'Admins'){
                         get args
                         $this->Auth->deny('delete','add','edit','index');
                }
    }


basically all I've done is copy what was on the manual.

About admins routing I also want to deny access to a different
controller as well. So they can't see admins and properties indexes
for both

I thought there was a simple way to do this but I guess not  =(
On May 9, 5:02 pm, "Sam Sherlock" <[EMAIL PROTECTED]> wrote:
> so that is the beoreFilter of the Admins controller
>
> and you have Auth set in your app_controller - post your auth set up too
>
> does putting parent::beforeFilter in the Admins controller help
>
> also you could use admin routing here which IMHO would simplify things a
> little
>
> hth - S
>
> 2008/5/9 Fabian <[EMAIL PROTECTED]>:
>
>
>
> > yes I've read it and thx for the if statement error but still the
> > index page is shown.
>
> > I've even tried doing it without the if statement
>
> > function beforeFilter()
> >  {
>
> >       $this->Auth->allow('*');
> >        $this->Auth->deny('delete','add','edit','index');
>
> > }
>
> > and still all the indexes are showing up
>
> > On May 9, 4:44 pm, "Sam Sherlock" <[EMAIL PROTECTED]> wrote:
> > > in your if state your assigning the value the one below compares the
> > values
>
> > > if ($this->name == 'Admins'){}
>
> > > have you  read the auth section of book.cakephp.org?
>
> > > 2008/5/9 Fabian <[EMAIL PROTECTED]>:
>
> > > > Hi all.
>
> > > > I'm having problem using the deny and allow methods for the index
> > > > function.
>
> > > > In my app controller I have
>
> > > > function beforeFilter()
> > > >  {
>
> > > >       $this->Auth->allow('*');
> > > >       $this->Auth->deny('delete','add','edit');
>
> > > >      if ($this->name = 'Admins'){
> > > >         $this->Auth->deny('delete','add','edit','index');
> > > >        }
>
> > > > }
>
> > > > so if I try to use any url like admins/add if forces me to login , but
> > > > it doesn't seem to work for the admins/index
>
> > > > What is the correct string I have to place in the deny array so it
> > > > actually denies the index. I've tried using display, read and view.
> > > > But none of them work.
>
> > > > Thanks in advance
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to