Select to view content in your preferred language

Cannot enable 'Any organization's members' setting when creating a Group or updating properties

1058
6
Jump to solution
06-15-2023 01:23 AM
Labels (1)
Clubdebambos
Frequent Contributor

I am creating a group using the ArcGIS for Python API, there is limited information in the API Reference here.

And I found some more information in the Rest Reference relating to the membershipAccess property that it can be org | collaboration | none, and none is the default. The ArcGIS for Python API also indicates that the default is None based on the parameters for the create function.

The default, however, when I run the below snippet is that the membershipAccess property is set to org.

 

from arcgis.gis import GIS

agol = GIS("home")

agol.groups.create(
    title = "Test_Group",
    tags = ["Test", "Group"],
)

 

Clubdebambos_0-1686817066512.png

Even if I use the update function to update the membershipAccess to None it does not take? What settings can I use to perform this action using the ArcGIS for Python API, or is it simply a bug?

 

from arcgis.gis import GIS

agol = GIS("home")

group = agol.groups.get("GROUP_ID")

group.update(
    membership_access = None # typo fixed from acess
)

 

 

If I set manually to Any organization's members, and the query that property, the property does not exist, but it does exist when org or collaboration is set.

~ learn.finaldraftmapping.com
1 Solution

Accepted Solutions
Clubdebambos
Frequent Contributor

Submitted as a bug https://github.com/Esri/arcgis-python-api/issues/1590

Workaround by KHimba on GIS StackExchange and code posted below.

from arcgis.gis import GIS

agol = GIS("home")

g = agol.groups.create(
    title = "Test_Group1112",
    tags = ["Test", "Group"]
)

gId = g.id
params = {"membershipAccess": "", "clearEmptyFields":"true"}
update = agol._con.post("{}/sharing/rest/community/groups/{}/update".format(agol.url, gId), params)
print(update)
~ learn.finaldraftmapping.com

View solution in original post

6 Replies
ChristopherCounsell
MVP Regular Contributor

membership_access

Did you drop a 'c' from access?

0 Kudos
Clubdebambos
Frequent Contributor

Sorry, that was just a typo

~ learn.finaldraftmapping.com
ChristopherCounsell
MVP Regular Contributor

Also just to flesh it out a bit more
create() and update() support the GroupManager properties listed here:

https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis.GroupManager

Per this guide on accessing and managing groups / updating a group

https://developers.arcgis.com/python/guide/accessing-and-managing-groups/#updating-a-group

I think you're ok but maybe just that typo in membership_access.

Also, some other group settings may restrict your groups to members only. So if you've somehow enabled one of them, it may not give you the option to change the membership access. You can check this setting via the UI - if you can't do it there, you can't do it in python.

0 Kudos
Clubdebambos
Frequent Contributor

The parameter for membership_access defaults to None, which according to the documentation (rest) should set  to Any organization's members  in the Group settings. This is not the case, the default is org and using the update function and setting to None is not honoured. When I set it manually in the Group settings to Any organization's members, the membershipAccess property disappears from the JSON. The arcgis module version is 2.1.0.2

~ learn.finaldraftmapping.com
0 Kudos
Clubdebambos
Frequent Contributor

It looks like the membership_access parameter is new as of arcgis module version 2.1 as it is not in 2.0. Here is the description from using the python help function. The default, however, is not None, it is org and I cannot seem to set it to None to allow any organization access unless I perform manually.

Clubdebambos_0-1686841857922.png

 

 

~ learn.finaldraftmapping.com
0 Kudos
Clubdebambos
Frequent Contributor

Submitted as a bug https://github.com/Esri/arcgis-python-api/issues/1590

Workaround by KHimba on GIS StackExchange and code posted below.

from arcgis.gis import GIS

agol = GIS("home")

g = agol.groups.create(
    title = "Test_Group1112",
    tags = ["Test", "Group"]
)

gId = g.id
params = {"membershipAccess": "", "clearEmptyFields":"true"}
update = agol._con.post("{}/sharing/rest/community/groups/{}/update".format(agol.url, gId), params)
print(update)
~ learn.finaldraftmapping.com