Interface RuleComponentRestrictionStore
- All Known Implementing Classes:
JiraRuleComponentRestrictionStore
public interface RuleComponentRestrictionStore
Store interface for managing rule component restrictions.
Provides CRUD operations for instance-wide restrictions on automation rule components
(triggers, conditions, actions) based on Jira group allow-lists.
Restriction Semantics:
- No entry for a component key: component is UNRESTRICTED (all users can use it)
- Entry with non-empty group set: component is restricted to users in those groups
- Entry with empty group set: component is FULLY RESTRICTED (no users can use it)
Thread-safe and DC-safe persistence layer.
-
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 for the instance.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.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 for the instance. Semantics: - Empty map: no restrictions configured - Entry with non-empty set: component is restricted to those groups - Entry with empty set: component is fully restricted (no one can use it)- Parameters:
context- the tenant context- Returns:
- 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.- Parameters:
context- the tenant contextruleComponentKey- the rule component key (e.g., "jira.issue.created")- Returns:
- optional set of allowed group names, empty if no restrictions exist
-
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. The restriction entry is always preserved. To remove restrictions entirely (making the component unrestricted), usedeleteRestrictions(com.codebarrel.tenant.api.TenantContext, java.lang.String).- Parameters:
context- the tenant contextruleComponentKey- the rule component keygroupNames- the set of allowed group names (empty means fully restricted - no one can use)updatedBy- the user key of the user making the change
-
deleteRestrictions
Removes restrictions for a specific rule component. After removal, the component becomes unrestricted.- Parameters:
context- the tenant contextruleComponentKey- the rule component key
-
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:
- map of rule component key to detailed configuration
-
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:- Deletes all existing restrictions
- Creates new restrictions for all provided component keys
This operation is transactional - either all restrictions are replaced or none are (rollback on failure).
- 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.If a restriction's only allowed group is removed, the restriction entry remains with an empty group set (meaning fully restricted).
This operation is typically called asynchronously in response to a group deletion event.
- Parameters:
context- the tenant contextgroupName- the name of the group to remove from all restrictions- Returns:
- the number of restrictions that were modified
-