diff --git a/framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions.cs b/framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions.cs
index c66d74b381..3dfc5218d0 100644
--- a/framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions.cs
+++ b/framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions.cs
@@ -108,6 +108,11 @@ public static class AbpAuthorizationServiceExtensions
return (await authorizationService.AuthorizeAsync(resource, policyName)).Succeeded;
}
+ ///
+ /// Checks if CurrentPrincipal meets a specific authorization policy, throwing an if not.
+ ///
+ /// The providing authorization.
+ /// The name of the policy to evaluate.
public static async Task CheckAsync(this IAuthorizationService authorizationService, string policyName)
{
if (!await authorizationService.IsGrantedAsync(policyName))
@@ -117,6 +122,12 @@ public static class AbpAuthorizationServiceExtensions
}
}
+ ///
+ /// Checks if CurrentPrincipal meets a specific requirement for the specified resource, throwing an if not.
+ ///
+ /// The providing authorization.
+ /// The resource to evaluate the policy against.
+ /// The requirement to evaluate the policy against.
public static async Task CheckAsync(this IAuthorizationService authorizationService, object resource, IAuthorizationRequirement requirement)
{
if (!await authorizationService.IsGrantedAsync(resource, requirement))
@@ -126,6 +137,12 @@ public static class AbpAuthorizationServiceExtensions
}
}
+ ///
+ /// Checks if CurrentPrincipal meets a specific authorization policy against the specified resource, throwing an if not.
+ ///
+ /// The providing authorization.
+ /// The resource to evaluate the policy against.
+ /// The policy to evaluate.
public static async Task CheckAsync(this IAuthorizationService authorizationService, object resource, AuthorizationPolicy policy)
{
if (!await authorizationService.IsGrantedAsync(resource, policy))
@@ -135,6 +152,11 @@ public static class AbpAuthorizationServiceExtensions
}
}
+ ///
+ /// Checks if CurrentPrincipal meets a specific authorization policy, throwing an if not.
+ ///
+ /// The providing authorization.
+ /// The policy to evaluate.
public static async Task CheckAsync(this IAuthorizationService authorizationService, AuthorizationPolicy policy)
{
if (!await authorizationService.IsGrantedAsync(policy))
@@ -143,6 +165,12 @@ public static class AbpAuthorizationServiceExtensions
}
}
+ ///
+ /// Checks if CurrentPrincipal meets a specific authorization policy against the specified resource, throwing an if not.
+ ///
+ /// The providing authorization.
+ /// The resource to evaluate the policy against.
+ /// The requirements to evaluate the policy against.
public static async Task CheckAsync(this IAuthorizationService authorizationService, object resource, IEnumerable requirements)
{
if (!await authorizationService.IsGrantedAsync(resource, requirements))
@@ -152,6 +180,12 @@ public static class AbpAuthorizationServiceExtensions
}
}
+ ///
+ /// Checks if CurrentPrincipal meets a specific authorization policy against the specified resource, throwing an if not.
+ ///
+ /// The providing authorization.
+ /// The resource to evaluate the policy against.
+ /// The name of the policy to evaluate.
public static async Task CheckAsync(this IAuthorizationService authorizationService, object resource, string policyName)
{
if (!await authorizationService.IsGrantedAsync(resource, policyName))
diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerExtensions.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerExtensions.cs
index b954578ba6..4bc2a5433c 100644
--- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerExtensions.cs
+++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerExtensions.cs
@@ -52,6 +52,11 @@ public static class FeatureCheckerExtensions
return false;
}
+ ///
+ /// Checks if the specified feature is enabled and throws an if it is not.
+ ///
+ /// The
+ /// The name of the feature to be checked.
public static async Task CheckEnabledAsync(this IFeatureChecker featureChecker, string featureName)
{
if (!(await featureChecker.IsEnabledAsync(featureName)))
@@ -61,6 +66,13 @@ public static class FeatureCheckerExtensions
}
}
+ ///
+ /// Checks if the specified features are enabled and throws an if they are not.
+ /// The check can either require all features to be enabled or just one, based on the parameter.
+ ///
+ /// The
+ /// True: Requires all features to be enabled. False: Requires at least one of the features to be enabled.
+ /// The names of the features to be checked.
public static async Task CheckEnabledAsync(this IFeatureChecker featureChecker, bool requiresAll, params string[] featureNames)
{
if (featureNames.IsNullOrEmpty())