8000 Update roles in runtime · Issue #376 · msgphp/msgphp · GitHub
[go: up one dir, main page]

Skip to content

Update roles in runtime #376

New issue

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

Closed
jkabat opened this issue Jan 21, 2020 · 2 comments
Closed

Update roles in runtime #376

jkabat opened this issue Jan 21, 2020 · 2 comments

Comments

@jkabat
Copy link
Contributor
jkabat commented Jan 21, 2020

Sometimes you need to update user identity during the same logged in session (eg: change user role from ROLE_PREMIUM_USER back to ROLE_USER). Symfony natively does not support it. You have to logout user and let him log again, which is not very user friendly.

In discussion at symfony/symfony#12025 some users suggest to update user token with new roles, but that is not very easy thing to do via msgphp-user-bundle as UserIdentity is final and cannot be extended with whatever logic developer would like to use.

What would be preferred way to handle such use cases?

ATM Im using permission system rather than roles which is kind of depressing because for things like that should user roles be used... What do you think?

@ro0NL
Copy link
Contributor
ro0NL commented Jan 21, 2020

HI @jkabat

I think i'd prefer e.g. symfony/symfony#12025 (comment), which should not be blocked our UserIdentity IIUC.

Overall i agree with symfony/symfony#12025 (comment) :D

Even if you need to re-login a user, that can be done programmatically as the user was already logged in. Which perhaps is the best approach.

AFAIK symfony/symfony#12025 (comment) is a non-issue then.

@jkabat
Copy link
Contributor Author
jkabat commented Jan 21, 2020

I have reread Kobzol suggestion again and yes it seems to be a solution where you can leave UserIdentity intact. I will reopen if anything arise. Thanks for such prompt answer.

@jkabat jkabat closed this as completed Jan 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants
0