|
|
|
|
@ -39,10 +39,17 @@ namespace Volo.Abp.Permissions
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual async Task GrantAsync(string name, string providerKey)
|
|
|
|
|
public virtual Task SetAsync(string name, string providerKey, bool isGranted)
|
|
|
|
|
{
|
|
|
|
|
var grant = await PermissionGrantRepository.FindAsync(name, Name, providerKey);
|
|
|
|
|
if (grant != null)
|
|
|
|
|
return isGranted
|
|
|
|
|
? GrantAsync(name, providerKey)
|
|
|
|
|
: RevokeAsync(name, providerKey);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual async Task GrantAsync(string name, string providerKey)
|
|
|
|
|
{
|
|
|
|
|
var permissionGrant = await PermissionGrantRepository.FindAsync(name, Name, providerKey);
|
|
|
|
|
if (permissionGrant != null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
@ -58,15 +65,15 @@ namespace Volo.Abp.Permissions
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual async Task RevokeAsync(string name, string providerKey)
|
|
|
|
|
protected virtual async Task RevokeAsync(string name, string providerKey)
|
|
|
|
|
{
|
|
|
|
|
var grant = await PermissionGrantRepository.FindAsync(name, Name, providerKey);
|
|
|
|
|
if (grant == null)
|
|
|
|
|
var permissionGrant = await PermissionGrantRepository.FindAsync(name, Name, providerKey);
|
|
|
|
|
if (permissionGrant == null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await PermissionGrantRepository.DeleteAsync(grant);
|
|
|
|
|
await PermissionGrantRepository.DeleteAsync(permissionGrant);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|