You can allow unauthorized access to action if your action is requested 
with requestAction method.

For example:

public function beforeFilter() {
    parent::beforeFilter();

    if ($this->request->is('requested') && $this->request->params['action'] 
== 'index') {
        $this->Auth->allow(array('index'));
    }
}

This may also work (haven't tested):

public function index() {
    if ($this->request->is('requested')) {
        $this->Auth->allow(array('index'));
    }
}

On Friday, June 21, 2013 7:31:07 PM UTC+3, Eric Haskins wrote:
>
> Hey All,
>
>       I am running cakePhp latest and I just ran into an issue with 
> requestAction and my auth.   It seems like even though I allow index action 
> in my NewsController 
>
> $latest_news = $this -> requestAction(array('controller' => 
> 'news','action' => 
> 'index'),array('named'=>array('limit'=>10,'sort'=>'desc')));   
>
> will result in a "Your Not Authorized To View This" redirect to 
> login........ Im stumped should I move my auth to a different location than 
> beforeFilter in appcontroller?
>
>
> Eric
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to