We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I get access to the currently logged in user object?
A call to $this->getUser(); in an action returns null.
$this->get('security.token_storage')->getToken()->getUser(); only returns the user name.
The code is here: https://github.com/jayrulez/sfapp/blob/9a767712acc747ff34d9a6d6ca35484ebf28af60/src/AppBundle/Controller/UserController.php
The text was updated successfully, but these errors were encountered:
I came with a way to get the user object.
I created a service for getting the user based on the username returned from the token getUser()
see method getUser() https://github.com/jayrulez/sfapp/blob/31a5865d378dd2565fffbd486bff4b586ede47a2/src/AppBundle/Helper/UserHelper.php
However, it all fal s down.
My users immediately lose access to their tokens on the next request after invoking an api call that updates their username.
see setUsernameAction: https://github.com/jayrulez/sfapp/blob/31a5865d378dd2565fffbd486bff4b586ede47a2/src/AppBundle/Controller/UserController.php
This is because the relationships in authbucket are username based instead of id based.
Typically users may change usernames but never their ids.
I think it would be better to make authbucket relationships id based.
Sorry, something went wrong.
I added this workaround to my project:
jayrulez/sfapp@7cdd214
However, I do not think this is a very clean solution
No branches or pull requests
How can I get access to the currently logged in user object?
A call to $this->getUser(); in an action returns null.
$this->get('security.token_storage')->getToken()->getUser(); only returns the user name.
The code is here: https://github.com/jayrulez/sfapp/blob/9a767712acc747ff34d9a6d6ca35484ebf28af60/src/AppBundle/Controller/UserController.php
The text was updated successfully, but these errors were encountered: