Update Usergroup SSO mappings via GraphQL
search cancel

Update Usergroup SSO mappings via GraphQL

book

Article ID: 418671

calendar_today

Updated On:

Products

CloudHealth

Issue/Introduction

Within Usergroups you can map a SSO attribute and value to automatically assign incoming users via SSO to a Usergroup. 

These mappings can also be updated via GraphQL in addition to the UI allowing you to make changes en masse.

Resolution

To update a Usergroups SSO mappings via GraphQL follow these steps:

  1. Open your GraphQL client, or utilize GraphQL explorer available under Setup -> Admin.

  2. Determine the CRN value of the Usergroup(s) you wish to update via the following call - 

    query UserGroupList {
      userGroups(first: 10) {
        nodes {
          id, name, description,identityAttributeRules {
          key
          values
        
        }
        }
      }
    }

     

  3. From the output, pull out the CRN's for the Usergroups you wish to update via the ID field, as well as the Name, and Description fields as these will be used as an input for the next GraphQL call - 



  4. Make use of the following Mutation - 

    mutation UpdateUserGroup($input: UpdateUserGroupInput!) {
      updateUserGroup(input: $input) {
        userGroup {
          id
          __typename
        }
        __typename
      }
    }


    Populating the following values under Variables - 

    {
      "input": {
        "id": "Copy the CRN from the ID field in the GraphQL output in Step 3",
        "name": "Copy the name from the GraphQL output in Step 3 or pass an updated value",
        "description": "Copy the description from the GraphQL output in Step 3 or pass an updated value",
        "identityAttributeRules": [
          {
            "key": "Specify the attribute you wish to map on e.g. groups, or roles",
            "values": [
              "Specify the value for the attribute you wish to map to this usergroup"
            ]
          }
          ,
          {
            "key": "Specify any other attribute you wish to map", 
            "values": [
              "Specify the value for the attribute you wish to map to this usergroup"
            ]
          }
        ]
      }
    }

     

  5. Validate the call has worked by navigating to Setup -> Admin -> Usergroups, and confirming that the new SSO attribute and value are displayed within the SSO mapping section under the details tab.