mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 04:49:33 -07:00
Fixed #1968
This commit is contained in:
parent
cb3cc8d590
commit
57b12f3664
1 changed files with 8 additions and 0 deletions
|
@ -472,8 +472,16 @@ namespace Ombi.Controllers
|
||||||
// Get the roles
|
// Get the roles
|
||||||
var userRoles = await UserManager.GetRolesAsync(user);
|
var userRoles = await UserManager.GetRolesAsync(user);
|
||||||
|
|
||||||
|
// Am I modifying myself?
|
||||||
|
var modifyingSelf = user.UserName.Equals(User.Identity.Name, StringComparison.CurrentCultureIgnoreCase);
|
||||||
|
|
||||||
foreach (var role in userRoles)
|
foreach (var role in userRoles)
|
||||||
{
|
{
|
||||||
|
if (modifyingSelf && role.Equals(OmbiRoles.Admin))
|
||||||
|
{
|
||||||
|
// We do not want to remove the admin role from yourself, this must be an accident
|
||||||
|
continue;
|
||||||
|
}
|
||||||
await UserManager.RemoveFromRoleAsync(user, role);
|
await UserManager.RemoveFromRoleAsync(user, role);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue