Reputation: 106
I'm new at the latest cakephp versions and hadn't used the Authentication Component until now. I'm trying to validate a user being an admin but can't find how to get the user id to get it, nor how to get the identifier. $this->Authentication->getIdentifier()
throws an error that the identifier does not exist.
In general I'm trying to do a little cms to learn new framework usage and such. Haven't used it since 2.x
Upvotes: 1
Views: 353
Reputation: 93
It's $this->Authentication->getIdentity()->getIdentifier()
to get the id. You can also use the get()-method to get other fields, for example $this->Authentication->getIdentity()->get('username')
returns the username.
Upvotes: 4