mirror of https://github.com/abpframework/abp.git
18 changed files with 405 additions and 24 deletions
@ -0,0 +1,31 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
|
||||
|
namespace Volo.Abp.Authorization.Permissions |
||||
|
{ |
||||
|
public class MultiplePermissionGrantResult |
||||
|
{ |
||||
|
public bool AllGranted |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
return Result.Values.All(x => x == PermissionGrantResult.Granted); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public bool AllProhibited |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
return Result.Values.All(x => x == PermissionGrantResult.Prohibited); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public Dictionary<string, PermissionGrantResult> Result { get; } |
||||
|
|
||||
|
public MultiplePermissionGrantResult() |
||||
|
{ |
||||
|
Result = new Dictionary<string, PermissionGrantResult>(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,25 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Security.Claims; |
||||
|
using JetBrains.Annotations; |
||||
|
|
||||
|
namespace Volo.Abp.Authorization.Permissions |
||||
|
{ |
||||
|
public class PermissionValuesCheckContext |
||||
|
{ |
||||
|
[NotNull] |
||||
|
public List<PermissionDefinition> Permissions { get; } |
||||
|
|
||||
|
[CanBeNull] |
||||
|
public ClaimsPrincipal Principal { get; } |
||||
|
|
||||
|
public PermissionValuesCheckContext( |
||||
|
[NotNull] List<PermissionDefinition> permissions, |
||||
|
[CanBeNull] ClaimsPrincipal principal) |
||||
|
{ |
||||
|
Check.NotNull(permissions, nameof(permissions)); |
||||
|
|
||||
|
Permissions = permissions; |
||||
|
Principal = principal; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue