mirror of https://github.com/abpframework/abp.git
committed by
GitHub
19 changed files with 90 additions and 72 deletions
@ -1,20 +0,0 @@ |
|||||
using System.Security.Claims; |
|
||||
using System.Threading.Tasks; |
|
||||
|
|
||||
namespace Volo.Abp.Authorization.Permissions |
|
||||
{ |
|
||||
public static class PermissionCheckerExtensions |
|
||||
{ |
|
||||
public static async Task<bool> IsGrantedAsync(this IPermissionChecker permissionChecker, string name) |
|
||||
{ |
|
||||
return (await permissionChecker.CheckAsync(name)).IsGranted; |
|
||||
} |
|
||||
|
|
||||
public static async Task<bool> IsGrantedAsync(this IPermissionChecker permissionChecker, ClaimsPrincipal principal, string name) |
|
||||
{ |
|
||||
return (await permissionChecker.CheckAsync(principal, name)).IsGranted; |
|
||||
} |
|
||||
|
|
||||
//TODO: Add sync extensions
|
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,9 @@ |
|||||
|
namespace Volo.Abp.Authorization.Permissions |
||||
|
{ |
||||
|
public enum PermissionGrantResult |
||||
|
{ |
||||
|
Undefined, |
||||
|
Granted, |
||||
|
Prohibited |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,16 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Volo.Abp.Threading |
||||
|
{ |
||||
|
public static class TaskCache |
||||
|
{ |
||||
|
public static Task<bool> TrueResult { get; } |
||||
|
public static Task<bool> FalseResult { get; } |
||||
|
|
||||
|
static TaskCache() |
||||
|
{ |
||||
|
TrueResult = Task.FromResult(true); |
||||
|
FalseResult = Task.FromResult(false); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,8 +1,8 @@ |
|||||
using JetBrains.Annotations; |
using JetBrains.Annotations; |
||||
|
|
||||
namespace Volo.Abp.Authorization.Permissions |
namespace Volo.Abp.PermissionManagement |
||||
{ |
{ |
||||
public class PermissionValueProviderGrantInfo |
public class PermissionValueProviderGrantInfo //TODO: Rename to PermissionGrantInfo
|
||||
{ |
{ |
||||
public static PermissionValueProviderGrantInfo NonGranted { get; } = new PermissionValueProviderGrantInfo(false); |
public static PermissionValueProviderGrantInfo NonGranted { get; } = new PermissionValueProviderGrantInfo(false); |
||||
|
|
||||
Loading…
Reference in new issue