Automatic role by attribute is similar to automatic role by organization structure, both entities and dto's has same parent IdmAutomaticRole
for entities and AbstractIdmAutomaticRoleDto
for dto's. Both parent defined role and name attribute. Name attribute is only for better readability.
For automatic role by attribute exists two entities (and also dto's) IdmAutomaticRoleAttributeDto
and IdmAutomaticRoleAttributeRuleDto
these entities are in one-to-many (1:M) relation (automatic role by attribute has more definition of rules).
Automatic role by attribute (dto IdmAutomaticRoleAttributeDto
) has defined all attributes from his parent (AbstractIdmAutomaticRoleDto
) and plus attribute concept see Inconsistent state. For automatic role by attribute isn't possible update role and name attribute.
Individual rules for automatic roles by attribute, now is possible connect rules only with AND operator.
AutomaticRoleAttributeRuleType
defined for with type is this rule (e.q. identity, contract, identity eav and contract eav),AutomaticRoleAttributeRuleComparison
with comparison, now only equals.After add, delete or update rule for automatic role by attribute is this automatic role in inconsistent state. Inconsistent state mean that is possible that some user has or hasn't assigned this automatic role event if it should be assigned or removed.
Inconsistent state we can repair by recalculate roles for this automatic role. Recalculation is done by long running task ProcessAutomaticRoleByAttributeTaskExecutor
, this task need only id of automatic role by attribute. LRT assign role for all new users that pass rules and remove role for all users that already didn't passed.
Recalculation is process that recalculate automatic role for all users. In two db query is get all new users that pass the automatic role by attribute and all users that already din't pass. For these two set is create requests.
For automatic role by attribute was created two new processor IdentityAutomaticRoleProcessor
and IdentityContractAutomaticRoleProcessor
both these processors catch event for UPDATE, CREATE and EAV_SAVE. After catch event is done recalculate all automatic roles only for identity that is save.
After update, delete or add rule for automatic role by attribute is this automatic role in inconsistent state (see Inconsistent state). User that update, delete or add rule is ask for immediate recalculation by modal window.
Long running task ProcessAutomaticRoleByAttributeTaskExecutor
process automatic role (given in attribute), this task process all users.