Remove previously mapped role - Sonatype Lifecycle & Repository Firewall - Sonatype Community
Remove previously mapped role
post by brandon.bhagwandeen on Oct 31, 2018
Brandon Bhagwandeen
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.
post by mworthington on Oct 31, 2018
Michael Worthington
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!!)
post by brandon.bhagwandeen on Nov 2, 2018
Brandon Bhagwandeen
Thank you, @mworthington. That works perfectly.