Hello Community,
I need to modify the role owner of several roles at once ( 800)
What is the best way to do it please ? Any documentation on this subject would be much appreciated too,
Thank you,
Hello Community,
I need to modify the role owner of several roles at once ( 800)
What is the best way to do it please ? Any documentation on this subject would be much appreciated too,
Thank you,
the best way is you can use script that will apply on bulk, may be you can use python script
Do you have any example please?
Hello Torry,
I am sending you my script example that I did before.
modifyRole.py (3.4 KB)
You just need to adapt it with your role configuration.
You can use as input a CSV file to store all your information regarding your 800 roles.
I hope it will help you ![]()
I used following for APs you just change role API for the following, and use update offset 0, 250, 500 etc until all roles looped
import requests
import json
accessToken = ''
org = ''
getAccessProfileUrl = f'https://{org}.api.identitynow.com/beta/access-profiles?limit=250&offset=200'
accessProfiles = requests.request("GET", getAccessProfileUrl, headers={ 'Authorization': 'Bearer ' + accessToken }).json()
ownerId = ''
ownerName = ''
patchBody = json.dumps([
{
"op": "replace",
"path": "/owner",
"value": {
"type": "IDENTITY",
"id": ownerId,
"name": ownerName
}
}
])
for accessProfile in accessProfiles:
z=accessProfile["id"]
updateUrl = 'https://org.api.identitynow.com/beta/access-profiles/'+z
headers = {
'Content-Type': 'application/json-patch+json',
'Authorization': 'Bearer ' + accessToken
}
updatedAccessProfile = requests.request("PATCH", updateUrl, headers=headers, data=patchBody).json()
print(f'Changed owner for {updatedAccessProfile["name"]} to {ownerName}')
print('Finished')
@torry_salamat ,
There are multiple ways this can be achieved.
![]()
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.