diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserRoleDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserRoleDisplayDriver.cs index 9ebac41d371..982c5036701 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserRoleDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserRoleDisplayDriver.cs @@ -96,17 +96,15 @@ public override IDisplayResult Edit(User user) public override async Task UpdateAsync(User user, UpdateEditorContext context) { - var model = new EditUserRoleViewModel(); - // The current user cannot alter their own roles. This prevents them removing access to the site for themselves. if (_httpContextAccessor.HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier) == user.UserId && !await _authorizationService.AuthorizeAsync(_httpContextAccessor.HttpContext.User, StandardPermissions.SiteOwner)) { - await _notifier.WarningAsync(H["Cannot update your own roles."]); - - return Edit(user); + return null; } + var model = new EditUserRoleViewModel(); + if (await context.Updater.TryUpdateModelAsync(model, Prefix)) { var roles = await GetRoleAsync();