|
|
@ -30,30 +30,9 @@ namespace Volo.Abp.PermissionManagement.Identity |
|
|
|
|
|
|
|
|
public override async Task<PermissionValueProviderGrantInfo> CheckAsync(string name, string providerName, string providerKey) |
|
|
public override async Task<PermissionValueProviderGrantInfo> CheckAsync(string name, string providerName, string providerKey) |
|
|
{ |
|
|
{ |
|
|
if (providerName == Name) |
|
|
var multipleGrantInfo = await CheckAsync(new[] {name}, providerName, providerKey); |
|
|
{ |
|
|
|
|
|
return new PermissionValueProviderGrantInfo( |
|
|
|
|
|
await PermissionGrantRepository.FindAsync(name, providerName, providerKey) != null, |
|
|
|
|
|
providerKey |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (providerName == UserPermissionValueProvider.ProviderName) |
|
|
|
|
|
{ |
|
|
|
|
|
var userId = Guid.Parse(providerKey); |
|
|
|
|
|
var roleNames = await UserRoleFinder.GetRolesAsync(userId); |
|
|
|
|
|
|
|
|
|
|
|
foreach (var roleName in roleNames) |
|
|
|
|
|
{ |
|
|
|
|
|
var permissionGrant = await PermissionGrantRepository.FindAsync(name, Name, roleName); |
|
|
|
|
|
if (permissionGrant != null) |
|
|
|
|
|
{ |
|
|
|
|
|
return new PermissionValueProviderGrantInfo(true, roleName); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return PermissionValueProviderGrantInfo.NonGranted; |
|
|
return multipleGrantInfo.Result.Values.First(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public override async Task<MultiplePermissionValueProviderGrantInfo> CheckAsync(string[] names, string providerName, string providerKey) |
|
|
public override async Task<MultiplePermissionValueProviderGrantInfo> CheckAsync(string[] names, string providerName, string providerKey) |
|
|
@ -85,9 +64,10 @@ namespace Volo.Abp.PermissionManagement.Identity |
|
|
|
|
|
|
|
|
foreach (var permissionName in names) |
|
|
foreach (var permissionName in names) |
|
|
{ |
|
|
{ |
|
|
if (permissionGrants.Any(x => x.Name == permissionName)) |
|
|
var permissionGrant = permissionGrants.FirstOrDefault(x => x.Name == permissionName); |
|
|
|
|
|
if (permissionGrant != null) |
|
|
{ |
|
|
{ |
|
|
multiplePermissionValueProviderGrantInfo.Result[permissionName] = new PermissionValueProviderGrantInfo(true, providerKey); |
|
|
multiplePermissionValueProviderGrantInfo.Result[permissionName] = new PermissionValueProviderGrantInfo(true, permissionGrant.ProviderKey); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|