diff --git a/services/src/main/java/org/keycloak/services/resources/admin/permissions/GroupPermissions.java b/services/src/main/java/org/keycloak/services/resources/admin/permissions/GroupPermissions.java index 722ea1c7a7..b20d4626df 100644 --- a/services/src/main/java/org/keycloak/services/resources/admin/permissions/GroupPermissions.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/permissions/GroupPermissions.java @@ -185,9 +185,13 @@ class GroupPermissions implements GroupPermissionEvaluator, GroupPermissionManag authz.getStoreFactory().getPolicyStore().delete(manageMembersPermission.getId()); } Policy viewMembersPermission = viewMembersPermission(group); - if (manageMembersPermission == null) { + if (viewMembersPermission == null) { authz.getStoreFactory().getPolicyStore().delete(viewMembersPermission.getId()); } + Policy manageMembershipPermission = manageMembershipPermission(group); + if (manageMembershipPermission != null) { + authz.getStoreFactory().getPolicyStore().delete(manageMembershipPermission.getId()); + } Resource resource = groupResource(group); if (resource != null) authz.getStoreFactory().getResourceStore().delete(resource.getId()); }