Portal 10.6.1, running from IDE, GIS module - class arcgis.gis.User(gis, username, userdict=None)
I'm testing some Python API functionality to automate some listing of users, groups, access etc. and wanted to programmatically assess users which have had their access to the Portal disabled.
This is part of a larger aim, but at the moment I just want to be able to test if a user has been disabled or not, when that works, I'm happy with the rest of the coding.
using the API reference for the User class- https://developers.arcgis.com/python/api-reference/1.6.1/arcgis.gis.toc.html#user
the 'disabled' property when queried seems to return the correct True/False on my test accounts - although the documentation (also for the REST API) states - disabled - 'disables access to the organisation by the user')
I seem to be getting the correct boolean returned but I just wanted to be sure, as the documentation is a bit weak or misleading on this one (something I've found consistently across the API documentation).
trying the disable() method just to test it out also doesn't work.
#connect to portal, it connects fine
gis = GIS(url, username, password)
#search for user testeditor2
user = gis.users.search(query="username: testeditor2")
#check if user is disabled
print(user[0].disabled)
#returns False
#access testeditor2 from user list index 0 and try disable method
user[0].disable()
#returns
#File "C:\Users\username\.conda\envs\py377\lib\urllib\request.py", line 649, #in http_error_default
#raise HTTPError(req.full_url, code, msg, hdrs, fp)