You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When adding multiple roles or generally updating a user's roles, I'd like to be able to just give UserManager.AddToRolesAsync() the full list of roles that the user should have and have it add any new roles. As it currently is, if the user already has even 1 of the roles being assigned, the operation reports as a failure, at best having added any new roles in the list prior to the role that the user already has.
Similarly, when removing roles, UserManager.RemoveFromRolesAsync() will fail if the user does not have any of the given roles when, in my opinion, it should ignore those and continue with removing any that the user does have.
Looking at the code, it appears that it could be as simple as changing return new IdentityResult(Resources.UserAlreadyInRole); to continue; in UserManager.AddToRolesAsync() and changing return new IdentityResult(Resources.UserNotInRole); to continue; in UserManager.RemoveFromRolesAsync().
The text was updated successfully, but these errors were encountered:
When adding multiple roles or generally updating a user's roles, I'd like to be able to just give
UserManager.AddToRolesAsync()
the full list of roles that the user should have and have it add any new roles. As it currently is, if the user already has even 1 of the roles being assigned, the operation reports as a failure, at best having added any new roles in the list prior to the role that the user already has.Similarly, when removing roles,
UserManager.RemoveFromRolesAsync()
will fail if the user does not have any of the given roles when, in my opinion, it should ignore those and continue with removing any that the user does have.Looking at the code, it appears that it could be as simple as changing
return new IdentityResult(Resources.UserAlreadyInRole);
tocontinue;
inUserManager.AddToRolesAsync()
and changingreturn new IdentityResult(Resources.UserNotInRole);
tocontinue;
inUserManager.RemoveFromRolesAsync()
.The text was updated successfully, but these errors were encountered: