@ -9,5 +9,7 @@ namespace Volo.Abp.Authorization.Permissions
PermissionGroupDefinition GetGroupOrNull(string name);
PermissionGroupDefinition AddGroup([NotNull] string name, ILocalizableString displayName = null);
void RemoveGroup(string name);
}
@ -36,5 +36,16 @@ namespace Volo.Abp.Authorization.Permissions
return Groups[name];
public virtual void RemoveGroup(string name)
{
Check.NotNull(name, nameof(name));
if (!Groups.ContainsKey(name))
throw new AbpException($"Not found permission group with name: {name}");
Groups.Remove(name);
@ -50,7 +50,7 @@ namespace Volo.Abp.Authorization
[Fact]
public void Should_Permission_Definition_GetGroup()
_permissionDefinitionManager.GetGroups().Count.ShouldBe(2);
_permissionDefinitionManager.GetGroups().Count.ShouldBe(1);
@ -13,6 +13,8 @@ namespace Volo.Abp.Authorization.TestServices
PermissionGroupDefinition group = context.AddGroup("TestGroup");
group.AddPermission("MyAuthorizedService1");
context.RemoveGroup("TestGetGroup");