Problem:

We can not define required groups for a sync because we need to use a different attribute than the group name.


Solution:

UserSync supports writing groovy code in order to make decisions about whether a group is a required group or not


To activate this, go to Edit on your UserSync connector, select the ... Specific Settings tab, and check the Use Groovy to select required groups option.



isRequiredGroup returns true, if and only if a group is required group.


Parameter NameMeaning
groupDataA map containing all attributes of a group, e.g. if the group contains an attribute "id", you can acces it via groupData.id or groupData.get("id")



If you see the need for a custom function but have problems realizing it, please contact us at https://www.resolution.de/go/support.


Example

"A required group is a required group if the group's id has a specific value".


boolean isRequiredGroup(StructuredData groupData) {
    return groupData.id == "d655855f-7235-41e8-a5b6-152dc77e65f7"
}
CODE



"A required group is a required group if the group's id is one of some values".

boolean isRequiredGroup(StructuredData groupData) {
    return groupData.id in ["group1_id_from_keycloak", "group2_id_from_keycloak"]
}
CODE