The March 2022 update brought Member Categories to ArcGIS Online. It would be great if this property was accessible via the ArcGIS API for Python, in the user class of the gis module.
We have a decent-sized organization with many decentralized divisions within when it comes to GIS, so updates like Member Categories are much appreciated. By exposing this info via the API, we can build Dashboards updated via Notebooks to help track our user base.
Also would love to get to something like what was previously suggested in another Idea post, for tying custom role permissions to something like member categories.
This should definitely be in the api docs. There is an id property on the user so I tried applying a category to a user using the same method as if it were a content item and it failed. Anyway this needs to be added in order for us to really make use of it.
This is a great idea and one, ironically, I was looking at just now too. I built a script that pulls a users data via LDAP and was going to use that to auto set the category of the user (department). Too bad it is not a readily available option yet.
I haven't had a chance to check since the ArcGIS Online update occurred last night (11/9), but I didn't see anything on the release note blog mentioning it. I also don't see it in the documentation yet, either: https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#user
@Egelkroutk, @mada, @r3weber , @John_Spence
Looks like this info is available via the UserManager: https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis.UserManager.catego...
Not sure how long it's been there, I kept expecting to find it under the gis.user class with those other properties.
Example (Using AGO Notebooks):
from arcgis.gis import GIS
gis = GIS("home")
users = gis.users.search(max_users=10) #just using first 10 as example
for user in users:
print(user.categories)
@AaronKoelker I don't know about the others, but I was wanting to assign a category to a user. Not seeing that as an option currently, but I need to take a closer look.
Thanks for keeping an eye out.
I haven't tried it yet, but looks like you can use assign_categories( users, categories)
@AaronKoelker , same boat here. Looked like it, but the more I looked at it it appeared to be adding categories to be assigned, but not to the specific user.
It just didn't fit the flow of the documentation otherwise.
I need to look closer at it though.
Using the update method worked for me
user = gis.users.get(username='testuser')
user.update(categories = ["/Categories/TestCategory"])
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.