question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

item.shared_with Groups permissions issue

See original GitHub issue

Describe Issue There appears to be a permissions issue when accessing the groups an item is shared with. I can still access the ‘everyone’ and ‘org’ values without any issues. This only occurs for 23 out of 198 feature services. All items are owned by the same user, and after comparing all of the items that cause the error and the items that work without issue, there don’t appear to be any patterns or similarities that would cause these items to fail.

History Within the past year all layers on AGO transferred from one account to another. I have verified that the account I’m logging in through and the owner of feature services the issue occurs for are the same.

Platform Windows 10 Pro Python v3.7.9 ArcGIS API v1.8.5 Updated to Python v3.7.11 and API v1.9.1 and the issue remains

Example of the error

item = gis.content.search(query='id:[itemId_here]')
for k,v in item[0].shared_with.items():
	print(k,v)
	
everyone False
org True
groups Traceback (most recent call last):
  File "<pyshell#60>", line 2, in <module>
    print(k,v)
  File "C:\Users\...\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\__init__.py", line 6343, in __repr__
    return '<%s title:"%s" owner:%s>' % (type(self).__name__, self.title, self.owner)
  File "C:\Users\...\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\__init__.py", line 6321, in __getattr__
    self._hydrate()
  File "C:\Users\...\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\__init__.py", line 6314, in _hydrate
    groupdict = self._portal.get_group(self.groupid)
  File "C:\Users\...\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\_impl\_portalpy.py", line 949, in get_group
    return self.con.post('community/groups/' + group_id, self._postdata())
  File "C:\Users\...\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 720, in post
    force_bytes=kwargs.pop('force_bytes', False))
  File "C:\Users\...\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 514, in _handle_response
    self._handle_json_error(data['error'], errorcode)
  File "C:\Users\...\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 536, in _handle_json_error
    raise Exception(errormessage)
Exception: You do not have permissions to access this resource or perform this operation.
(Error Code: 403)

The error is exactly the same if I call ‘groups’ with the code below:

item[0].shared_with['groups']

To Reproduce The below code can be run to find feature services within your AGO account that this error occurs for.

from arcgis.gis import GIS

gis = GIS('https://www.arcgis.com',[username],[password])

user = gis.users.me
folders = user.folders

for f in folders:
    items = user.items(f['title'])
    
    for item in items:
        groups = []
        
        try:
            if item.shared_with['groups'] != []:
                for g in item.shared_with['groups']:
                    groups.append(g.title)
        except:
            print(item.id)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:17 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
MetroparksGIScommented, Apr 8, 2022

@achapkowski I cannot reproduce this issue with 2.0.0 and using Online or Enterprise 10.9.1

Maybe it’s been corrected already in 2.0.0. I think ArcGIS Pro v2.9.2 installs ArcGIS API v1.9.1 by default. I’ll update to the latest API version and see if the issue is still presenting. If so, maybe it’s something specific to my AGO account.

0reactions
jyaistMapcommented, Oct 25, 2022

Closing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Items shared with Groups are not showing up in "Shared with
I've tried following the user to get the files to show up and that did nothing. I've dug through the permissions options to...
Read more >
Allow user to only view items shared with their Group
the issue I am having: once I add this new user to my organization, I add them to the new group and share...
Read more >
Group access and permissions - GitLab Docs
Expand the Permissions and group features section. Select Projects in <group_name> cannot be shared with other groups. Select Save changes.
Read more >
Share content with a group - Google Support
Change access permissions for everyone at once, instead of changing them for each person manually. Avoid searching for everything you've ever shared with...
Read more >
Share items—Portal for ArcGIS
You can also share basemaps, apps, and other items that have been shared with the public or the portal with groups you own....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found