Interface RuleComponentRestrictionCacheManager
- All Known Implementing Classes:
JiraRuleComponentRestrictionCacheManager
public interface RuleComponentRestrictionCacheManager
Cache manager for rule component restrictions providing fast, cached access
to which rule components are allowed or restricted for permission checks.
Also provides per-user restricted component lists derived from global restrictions and user group memberships.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteRestrictions(TenantContext context, String ruleComponentKey) Removes restrictions for a specific rule component.getAllRestrictionConfigs(TenantContext context) Retrieves all restriction configurations with metadata.getAllRestrictions(TenantContext context) Retrieves all rule component restrictions from the cache.getRestrictedComponents(TenantContext context, String userKey, Set<String> groupNames) Retrieves per-user restricted component keys based on the current global restrictions and the user's group memberships.getRestrictionConfig(TenantContext context, String ruleComponentKey) Retrieves detailed configuration for a specific rule component restriction, including metadata like creation/update timestamps.getRestrictions(TenantContext context, String ruleComponentKey) Retrieves restrictions for a specific rule component from the cache.voidExplicitly invalidates the global restrictions cache.intremoveGroupFromAllRestrictions(TenantContext context, String groupName) Removes a group from all rule component restrictions.voidreplaceAllRestrictions(TenantContext context, Map<String, Set<String>> restrictions, String updatedBy) Replaces all restrictions with a new set of restrictions atomically.voidsetRestrictions(TenantContext context, String ruleComponentKey, Set<String> groupNames, String updatedBy) Sets restrictions for a specific rule component.
-
Method Details
-
getAllRestrictions
Retrieves all rule component restrictions from the cache. On first access or after cache expiry, loads from persistent store.Returns a map where:
- Key: rule component key (e.g., "jira.issue.created")
- Value: set of allowed group names (empty set = fully restricted)
Components not in the map are unrestricted.
- Parameters:
context- the tenant context- Returns:
- immutable map of rule component key to set of allowed group names
-
getRestrictions
@Nonnull Optional<Set<String>> getRestrictions(@Nonnull TenantContext context, @Nonnull String ruleComponentKey) Retrieves restrictions for a specific rule component from the cache.- Parameters:
context- the tenant contextruleComponentKey- the rule component key (e.g., "jira.issue.created")- Returns:
- optional set of allowed group names: - Empty optional: component is UNRESTRICTED - Present with empty set: component is FULLY RESTRICTED - Present with non-empty set: component is restricted to those groups
-
getRestrictedComponents
@Nonnull Set<String> getRestrictedComponents(@Nonnull TenantContext context, @Nonnull String userKey, @Nonnull Set<String> groupNames) Retrieves per-user restricted component keys based on the current global restrictions and the user's group memberships.Components not present in the returned set are unrestricted.
- Parameters:
context- the tenant contextuserKey- the user keygroupNames- group names for the user- Returns:
- restricted component keys for the user
-
getRestrictionConfig
@Nonnull Optional<RuleComponentRestrictionConfig> getRestrictionConfig(@Nonnull TenantContext context, @Nonnull String ruleComponentKey) Retrieves detailed configuration for a specific rule component restriction, including metadata like creation/update timestamps.- Parameters:
context- the tenant contextruleComponentKey- the rule component key- Returns:
- optional detailed configuration, empty if no restrictions exist
-
getAllRestrictionConfigs
@Nonnull Map<String,RuleComponentRestrictionConfig> getAllRestrictionConfigs(@Nonnull TenantContext context) Retrieves all restriction configurations with metadata.- Parameters:
context- the tenant context- Returns:
- immutable map of rule component key to detailed configuration
-
setRestrictions
void setRestrictions(@Nonnull TenantContext context, @Nonnull String ruleComponentKey, @Nonnull Set<String> groupNames, @Nonnull String updatedBy) Sets restrictions for a specific rule component. Creates a new restriction or updates an existing one with full replacement. Invalidates global cache locally and across cluster nodes.- Parameters:
context- the tenant contextruleComponentKey- the rule component keygroupNames- the set of allowed group names (empty means fully restricted)updatedBy- the user key of the user making the change
-
deleteRestrictions
Removes restrictions for a specific rule component. After removal, the component becomes unrestricted. Invalidates global cache locally and across cluster nodes.- Parameters:
context- the tenant contextruleComponentKey- the rule component key
-
invalidateGlobalCache
void invalidateGlobalCache()Explicitly invalidates the global restrictions cache. Propagates invalidation across cluster nodes, including per-user access caches. -
replaceAllRestrictions
void replaceAllRestrictions(@Nonnull TenantContext context, @Nonnull Map<String, Set<String>> restrictions, @Nonnull String updatedBy) Replaces all restrictions with a new set of restrictions atomically. This is a bulk operation that delegates to the store and invalidates the cache.This operation is transactional - either all restrictions are replaced or none are (rollback on failure).
Use case: REST PUT endpoint that replaces entire configuration.
- Parameters:
context- the tenant contextrestrictions- map of rule component key to set of allowed group names (empty map = remove all restrictions, empty set = fully restricted)updatedBy- the user key of the user making the change
-
removeGroupFromAllRestrictions
Removes a group from all rule component restrictions. This is used when a group is deleted to ensure stale group references are cleaned up from the restriction database.Invalidates the global cache after removal.
- Parameters:
context- the tenant contextgroupName- the name of the group to remove from all restrictions- Returns:
- the number of restrictions that were modified
-