Select to view content in your preferred language

Permission error when trying add user to group

610
0
10-05-2021 09:59 AM
Andy_Siegel
Emerging Contributor

In my ArcGIS Online organization, we are trying to run this Python script to reassign ownership of groups and items to another user in the organization: Automate ownership reassignment of ArcGIS Online items shared to groups with the Update capability.

I'm running into issue in this segment of the script:

# 3. Change ownership of the old user groups to a new user.
usergroups = olduser.groups
for group in usergroups:
  grp = gis.groups.get(group['id'])
  if (grp.owner == orig_userid):
    grp.reassign_to(new_userid)
  else:
    grp.add_users(new_userid)
    grp.remove_users(orig_userid)

Even though I have administrator access, the script fails on this line:

grp.add_users(new_userid)

The error states:

Exception: You do not have permissions to access this resource or perform this operation.
(Error Code: 403)

Does anyone know why the script is throwing this error? Thanks for any help you can provide!

Andy

0 Kudos
0 Replies