Remove previously mapped role

I previously used this to map roles:

{
    "memberMappings": [
        {
            "roleId": "1cddabf7fdaa47d6833454af10e0a3ef",
            "members": [
                {
                    "type": "USER",
                    "userOrGroupName": "user-owner"
                }
            ]
        }
    ]
}

I used it for adding groups to earlier roles and would like to remap those groups to new roles. I’ve been able to do that but not able to remove the old mappings so users in groups are now in two roles.

I’ve tried to set “userOrGroupName”: to “” and None but neither of those work.

1 Like

When you make the REST call to PUT the members back, it has to be the complete member array.

In this example, where there is only one member, and you want to remove it, you need to send back an empty array:

I previously used this to map roles:

{
    "memberMappings": [
        {
            "roleId": "1cddabf7fdaa47d6833454af10e0a3ef",
            "members": [
            ]
        }
    ]
}

NOTE: if you have other users or groups assigned to that same roleId, you will need to keep those other members in the array. (otherwise, you would end up removing all of them!!)

1 Like

Thank you, @mworthington. That works perfectly