MidPoint 3.7.1 and later
This feature is available only in midPoint 3.7.1 and later.
There are situations when you need to create non-tolerant focus mappings. This means that the focus (e.g. user) should have no values in particular item, unless provided by these mappings.
For mappings residing in object template this feature has been available since midPoint 3.3 (although marked as experimental); but until now it was not possible for mappings induced by assigned roles. Here we show how to do that.
Let us consider the example mentioned here (copied here for simplicity):
We "stamp" each focus with the description of assigned role.
To be effective, we outsource logic to one common meta role that all other stamping roles assigns:
Then each stamping role has assignment to this metarole:
Finally, any UserType that has assigned the Stamping role will have its fullName attribute populated with the value of the Stamping role's description ("stamp1-bearer" in this case).
In order to remove fullName attribute value when no stamping role is present, we create the following code in the user template:
The mapping marks
fullName attribute as non-tolerant. It means that all values not provided by the object template mappings are discarded. And we provide a very special mapping in the object template: it calls (experimental) method
midpoint.collectAssignedFocusMappingsResults which inspects recently computed assignments (lensContext.evaluatedAssignmentTriple), takes all non-negative values from mappings relevant to fullName from all evaluated non-negative assignments, and returns the value (if present) as its output.