Merge pull request #14023 from abpframework/abp.auth.policies

Remove `abp.auth.policies`.
pull/14318/head
Halil İbrahim Kalkan 3 years ago committed by GitHub
commit c46e83fdd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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())

@ -204,12 +204,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 () {

Loading…
Cancel
Save