Friday, September 24, 2010

Re: Auth->allow component umpredictable

Indeed, Miles J is correct.

On Sep 24, 1:21 pm, Miles J <mileswjohn...@gmail.com> wrote:
> I'm not sure thats how Auth works, it only accepts actions:
>
> // In books controller
> $this->Auth->allow('index');
>
> // In users controller
> $this->Auth->allow('collection', 'register');
>
> On Sep 24, 11:32 am, "Mariano C." <mariano.calan...@gmail.com> wrote:
>
>
>
> > Hi, this is my app_controller
>
> > class AppController extends Controller
> > {
> >         var $components = array('DebugKit.Toolbar', 'Auth', 'Session',
> > 'Facebook.Connect');
> >         var $helpers = array('Facebook.Facebook');
>
> >         function beforeFilter()
> >         {
> >                 $this->Auth->allow(array('books' => 'index'));
> >                 $this->Auth->allow(array('books' => 'details'));
> >                 $this->Auth->allow(array('authors' => 'index'));
> >                 $this->Auth->allow(array('authors' => 'details'));
> >                 $this->Auth->allow(array('users' => 'collection'));
> >                 $this->Auth->allow(array('users' => 'register'));
>
> >                $this->Auth->logoutRedirect = array('controller' =>
> > 'books', 'action' => 'index');
> >                $this->Auth->loginRedirect = array('controller' =>
> > 'books', 'action' => 'index');
> >        }
>
> > }
>
> > This is routes config
> > Router::connect(
> >         '/:username/collection',
> >         array('controller' => 'Users', 'action' => 'collection'),
> >         array('pass' => array('username'))
> >         );
>
> >         Router::connect(
> >         '/author/:slug',
> >         array('controller' => 'Authors', 'action' => 'details'),
> >         array('pass' => array('slug'))
> >         );
>
> >         Router::connect(
> >         '/book/:slug',
> >         array('controller' => 'Books', 'action' => 'details'),
> >         array('pass' => array('slug'))
> >         );
>
> > now mysite.com/author/stephen_king or mysite.com/book/the_green_mile
> > works perfectly. But if I call mysite.com/books or mysite.com/books/
> > index I will be forwarded to login page. Why???
>
> > The only allowed action are details action (that are routed under
> > different form)

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: