Jason McCreary
Jason McCreary

Reputation: 72961

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:

Upvotes: 0

Views: 348

Answers (1)

dogmatic69
dogmatic69

Reputation: 7575

  • 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.

Upvotes: 1

Related Questions