Skip to content

Transforming One Group Into Two With Groovy

Map/ Edit the mapping for the Groups attribute in the Attribute Mapping section

image2021-6-16_13-54-51.png


Use Groovy Code as Source Type and paste the Groovy Code from below.

image2021-6-16_13-54-9.png

You'll need to adjust the group names accordingly:

  1. // Input your data as per the descriptions below
  2. // Replace YourIDPGroupAttribute with your actual IdP Group Attribute
  3. def idpGroupAttribute = "groups"
  4. // the group with all the users you want to manage with license optimizer
  5. def idpGroupName = "Okta_Jira_Users"
  6. // adding the user to both the Allowed users- and the License Group
  7. def replacements = ["jira-software-users", "jira-software-licensed-users"]
  8. // No need to change anything from here on
  9. def groups = mapping.get(idpGroupAttribute)
  10. if (groups.contains(idpGroupName)) {
  11. groups.remove(idpGroupName)
  12. groups.addAll(replacements)
  13. }
  14. return groups