views:

196

answers:

0

I'm porting application from custom authentication system to cake's Auth. Everything works fine for logged user (even with smaller privileges), but doesn't for non logged users (who are most users of site). I'm managing privileges for them with $this->Auth->allow() in FooController::beforeFilter (but not with AppController::beforeFilter) eg.:

class FooController extends AppController{
      (...)
      public function beforeFilter(){
            parent::beforeFilter();
            this->Auth->allow('index');
      }
      (...)
}

After calling app/foo/index beforeFilter and beforeRender run and both ends. $this->Auth->allowedActions consists only name of controller's methods like 'index' or 'view' which can be called by user (eg. by entering proper address in browser). During page render Auth redirects user to login action (/users/login in my case) just after trying to do Cache::write in view. eg.:

Cache::write('news', $this->data, 'sidebar');

Actually i'm overriding this problem by commenting out every line beginning with "Cache::write" (disabling cache in core configuration doesn't work). But I like to get back to caching some time and i'm curious how to make it available to not logged user.

Thanks for all your help!