Browse Source
Deduplicate the changed permission names posted by the modal
pull/26127/head
maliming
1 day ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
1 changed files with
17 additions and
5 deletions
-
modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml.cs
|
|
|
@ -137,10 +137,20 @@ public class PermissionManagementModal : AbpPageModel |
|
|
|
|
|
|
|
protected virtual UpdatePermissionDto[] GetChangedPermissions() |
|
|
|
{ |
|
|
|
return SplitPermissionNames(GrantedPermissionNames) |
|
|
|
.Select(name => new UpdatePermissionDto { Name = name, IsGranted = true }) |
|
|
|
.Concat(SplitPermissionNames(RevokedPermissionNames) |
|
|
|
.Select(name => new UpdatePermissionDto { Name = name, IsGranted = false })) |
|
|
|
var permissions = new Dictionary<string, bool>(); |
|
|
|
|
|
|
|
foreach (var name in SplitPermissionNames(GrantedPermissionNames)) |
|
|
|
{ |
|
|
|
permissions[name] = true; |
|
|
|
} |
|
|
|
|
|
|
|
foreach (var name in SplitPermissionNames(RevokedPermissionNames)) |
|
|
|
{ |
|
|
|
permissions[name] = false; |
|
|
|
} |
|
|
|
|
|
|
|
return permissions |
|
|
|
.Select(permission => new UpdatePermissionDto { Name = permission.Key, IsGranted = permission.Value }) |
|
|
|
.ToArray(); |
|
|
|
} |
|
|
|
|
|
|
|
@ -148,7 +158,9 @@ public class PermissionManagementModal : AbpPageModel |
|
|
|
{ |
|
|
|
return names.IsNullOrWhiteSpace() |
|
|
|
? Array.Empty<string>() |
|
|
|
: names.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); |
|
|
|
: names.Split( |
|
|
|
new[] { '\r', '\n' }, |
|
|
|
StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); |
|
|
|
} |
|
|
|
|
|
|
|
public class PermissionGroupViewModel |
|
|
|
|