开发者

Loading additional data for authenticated user with CakePHP Auth Component

I have some additional data I want to load on each request for the authenticated user. I recently adopted the Auth Component. Previously, I was loading this additional data in my AppController's beforeFilter. I suppose I could leave it there and wrap the code within a test against $this->Auth->user();, but wanted to see if there were better way for both these items.

So the question is two part:

  • Is there a built in method of the Auth Component where I can load in additi开发者_运维问答onal data on each request for the authenticated user.
  • If not, is there a better way to do so than checking $this->Auth->user(); in the AppController's beforeFilter


  • no
  • few options
    • overloading auth component
    • roll your own
    • do the auth check, if they are logged in and the extra data is not around get it. it will obviously be an extra query, but its once per login... hardly a server killer.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜