Class ComponentRestrictionFeatureService
This service provides a centralized check that short-circuits restriction processing when the feature is not in use, optimizing performance and avoiding unnecessary database/cache lookups.
The following conditions will cause restriction processing to be skipped:
- Feature flag
a4j.automation.component.restrictionsis disabled - The user is a global administrator (exempt from component restrictions)
- No restriction configurations exist (feature not being used)
-
Constructor Summary
ConstructorsConstructorDescriptionComponentRestrictionFeatureService(FeatureFlagCache featureFlagCache, RuleComponentRestrictionCacheManager restrictionCacheManager, TenantService tenantService, GlobalPermissionManager globalPermissionManager) -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if project admins are allowed to edit automation rules based on global settings.booleanhasAnyRestrictionConfigs(TenantContext context) Checks if any restriction configurations exist for the given context.booleanChecks if the component restrictions feature flag is enabled.booleanshouldProcessRestrictions(TenantContext context, ApplicationUser user) Determines whether component restrictions should be processed for the given context and user.
-
Constructor Details
-
ComponentRestrictionFeatureService
@Inject public ComponentRestrictionFeatureService(FeatureFlagCache featureFlagCache, RuleComponentRestrictionCacheManager restrictionCacheManager, TenantService tenantService, GlobalPermissionManager globalPermissionManager)
-
-
Method Details
-
shouldProcessRestrictions
Determines whether component restrictions should be processed for the given context and user.This method performs a series of short-circuit checks to determine if restriction processing is necessary. Returns
falseif any short-circuit condition is met, allowing callers to skip expensive restriction lookups.Global administrators are always exempt from component restrictions: they can use any component regardless of configured restrictions.
- Parameters:
context- the tenant contextuser- the user performing the operation, ornullfor anonymous access- Returns:
trueif restrictions should be processed,falseto skip
-
isFeatureFlagEnabled
public boolean isFeatureFlagEnabled()Checks if the component restrictions feature flag is enabled.- Returns:
trueif the feature flag is enabled
-
hasAnyRestrictionConfigs
Checks if any restriction configurations exist for the given context.- Parameters:
context- the tenant context- Returns:
trueif at least one restriction config exists
-
areProjectAdminsAllowedToEditRules
Checks if project admins are allowed to edit automation rules based on global settings.When project admins cannot edit rules, only global admins can modify automation rules. Since global admins are always exempt from component restrictions, restriction processing becomes unnecessary.
- Parameters:
context- the tenant context- Returns:
trueif project admins are allowed to edit rules
-