Esri / arcgis-python-api

Documentation and samples for ArcGIS API for Python
https://developers.arcgis.com/python/
Apache License 2.0
1.87k stars 1.1k forks source link

Using assign_categories to assign an existing category to user #1500

Closed MSLTrebesch closed 1 year ago

MSLTrebesch commented 1 year ago

Describe the bug Using the UserManager class to assign an existing user category (already in AGOL portal, applied in interface). Am able to assign the category to the users object. They are visible in the AGOL interface, but cannot be filtered in the interface.

To Reproduce Steps to reproduce the behavior:

Add user category "test" in AGOL interface:

image

image

Run code from Notebook (ArcGIS API version 2.1.0.2):

from arcgis.gis import GIS
gis = GIS("home")
cat_users = gis.users.search(query='username:student_user_2')
print(cat_users)
gis.users.assign_categories(users=cat_users, categories=["test"])

output:

[<User username:student_user_2>]
[{'student_user_2': True}]

Screenshots Observing Categories given to user in AGOL: User shows in "test" category when accessing the member properties, "Categorize" menu option: Notice that the category is applied, but not checked on the left side menu. image

And when attempting to filter in AGOL under the "test" category, no users show up, though the above example shows the user is assigned to the category through the API call and interface: image

Expected behavior The above issue doesn't happen when working exclusively with AGOL interface - only when assigning categories, from an existing category created in AGOL to the user from the API via "assign_categories"

Platform (please complete the following information):

nanaeaubry commented 1 year ago

Hello, we will take a look at this, thank you for bringing it to our attention

nanaeaubry commented 1 year ago

Hello, you can try by defining the categories as such: ["/Categories/test"]

There was another small bug found that we fixed so it will be reflected in the next release. Thank you