From d32093136faa0aba6bf60d71b8d370088435ca58 Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 5 Sep 2017 23:41:58 +1000 Subject: [PATCH] U4-10214 Disable ability to delete admin group --- .../src/views/users/views/groups/groups.html | 1 + src/Umbraco.Web/Editors/UserGroupsController.cs | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/users/views/groups/groups.html b/src/Umbraco.Web.UI.Client/src/views/users/views/groups/groups.html index dddd931b1d..119c4f559d 100644 --- a/src/Umbraco.Web.UI.Client/src/views/users/views/groups/groups.html +++ b/src/Umbraco.Web.UI.Client/src/views/users/views/groups/groups.html @@ -84,6 +84,7 @@
diff --git a/src/Umbraco.Web/Editors/UserGroupsController.cs b/src/Umbraco.Web/Editors/UserGroupsController.cs index 33b1d9dc08..18777395d3 100644 --- a/src/Umbraco.Web/Editors/UserGroupsController.cs +++ b/src/Umbraco.Web/Editors/UserGroupsController.cs @@ -133,7 +133,10 @@ namespace Umbraco.Web.Editors [UserGroupAuthorization("userGroupIds")] public HttpResponseMessage PostDeleteUserGroups([FromUri] int[] userGroupIds) { - var userGroups = Services.UserService.GetAllUserGroups(userGroupIds).ToArray(); + var userGroups = Services.UserService.GetAllUserGroups(userGroupIds) + //never delete the admin group + .Where(x => x.Alias != Constants.Security.AdminGroupAlias) + .ToArray(); foreach (var userGroup in userGroups) { Services.UserService.DeleteUserGroup(userGroup);