maliming
4 years ago
No known key found for this signature in database
GPG Key ID: 96224957E51C89E
4 changed files with
3 additions and
12 deletions
-
docs/en/UI/AspNetCore/JavaScript-API/Auth.md
-
framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationAuthConfigurationDto.cs
-
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationAppService.cs
-
npm/packs/core/src/abp.js
|
|
|
@ -20,5 +20,4 @@ if (abp.auth.isGranted('DeleteUsers')) { |
|
|
|
|
|
|
|
* ` abp.auth.isAnyGranted(...)`: Gets one or more permission/policy names and returns `true` if at least one of them has granted. |
|
|
|
* `abp.auth.areAllGranted(...)`: Gets one or more permission/policy names and returns `true` if all of them of them have granted. |
|
|
|
* `abp.auth.policies`: This is an object where its keys are the permission/policy names. You can find all permission/policy names here. |
|
|
|
* `abp.auth.grantedPolicies`: This is an object where its keys are the permission/policy names. You can find the granted permission/policy names here. |
|
|
|
@ -6,13 +6,10 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations; |
|
|
|
[Serializable] |
|
|
|
public class ApplicationAuthConfigurationDto |
|
|
|
{ |
|
|
|
public Dictionary<string, bool> Policies { get; set; } |
|
|
|
|
|
|
|
public Dictionary<string, bool> GrantedPolicies { get; set; } |
|
|
|
|
|
|
|
public ApplicationAuthConfigurationDto() |
|
|
|
{ |
|
|
|
Policies = new Dictionary<string, bool>(); |
|
|
|
GrantedPolicies = new Dictionary<string, bool>(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -185,8 +185,6 @@ public class AbpApplicationConfigurationAppService : ApplicationService, IAbpApp |
|
|
|
|
|
|
|
foreach (var policyName in otherPolicyNames) |
|
|
|
{ |
|
|
|
authConfig.Policies[policyName] = true; |
|
|
|
|
|
|
|
if (await _authorizationService.IsGrantedAsync(policyName)) |
|
|
|
{ |
|
|
|
authConfig.GrantedPolicies[policyName] = true; |
|
|
|
@ -196,7 +194,6 @@ public class AbpApplicationConfigurationAppService : ApplicationService, IAbpApp |
|
|
|
var result = await _permissionChecker.IsGrantedAsync(abpPolicyNames.ToArray()); |
|
|
|
foreach (var (key, value) in result.Result) |
|
|
|
{ |
|
|
|
authConfig.Policies[key] = true; |
|
|
|
if (value == PermissionGrantResult.Granted) |
|
|
|
{ |
|
|
|
authConfig.GrantedPolicies[key] = true; |
|
|
|
@ -228,10 +225,10 @@ public class AbpApplicationConfigurationAppService : ApplicationService, IAbpApp |
|
|
|
foreach (var resourceName in resourceNames) |
|
|
|
{ |
|
|
|
var dictionary = new Dictionary<string, string>(); |
|
|
|
|
|
|
|
|
|
|
|
var localizer = await StringLocalizerFactory |
|
|
|
.CreateByResourceNameOrNullAsync(resourceName); |
|
|
|
|
|
|
|
|
|
|
|
if (localizer != null) |
|
|
|
{ |
|
|
|
foreach (var localizedString in await localizer.GetAllStringsAsync()) |
|
|
|
|
|
|
|
@ -201,12 +201,10 @@ var abp = abp || {}; |
|
|
|
|
|
|
|
abp.auth = abp.auth || {}; |
|
|
|
|
|
|
|
abp.auth.policies = abp.auth.policies || {}; |
|
|
|
|
|
|
|
abp.auth.grantedPolicies = abp.auth.grantedPolicies || {}; |
|
|
|
|
|
|
|
abp.auth.isGranted = function (policyName) { |
|
|
|
return abp.auth.policies[policyName] != undefined && abp.auth.grantedPolicies[policyName] != undefined; |
|
|
|
return abp.auth.grantedPolicies[policyName] != undefined; |
|
|
|
}; |
|
|
|
|
|
|
|
abp.auth.isAnyGranted = function () { |
|
|
|
|