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'sbeforeFilter
- 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.
精彩评论