Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Adding roles doesn't seem to be effective until the user logs out #8474
This is one tidbit that caught me off-guard. I can't see it mentioned on this docu page. If I might suggest, should this be briefly mentioned in this docs page and perhaps explained somewhere else at lenght?
The thing I noticed is that if a user is added to a role via userManager.AddToRoleAsync(idenityUser, role) while they are logged in, context.User.IsInRole(role) will still return false until the user logs out and in again.
I tried to modify this sample app to allow admins promote regular users to managers. The promotion was not successfull until they logged out. I also tried to enhance the signalR chat app presented in these docs pages to support accounts and to allow mods to mute users via userManager.AddToRoleAsync(idenityUser, "Muted"). This should be enforced immediatelly, not when the user in question logs out.
Is there any docs pages that covers this issue?
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Or the user signs out, signs in again. - right?