[Code Snippet] Find Custom Role of users that are in ArcGIS portal - ArcGIS

from arcgis.gis import *

self.portalInfo = GIS(self.portalUrl, self.userName, self.password)

self.portalUsers = self.portalInfo.users.search('')

users = self.portalUsers

roleManager = arcgis.gis.RoleManager(self.portalInfo)

roles = roleManager.all()

for user in users:

if hasattr(user,'roleId'):

for role in roles:

if(user.roleId == role.role_id):

print(user.username,user.role,role.name)

Comments

Popular posts from this blog

Prevent WPF Global Keyboard Hook from stops working after hitting keys a while C# .NET

Generate ArcGIS Token By URL Request From ArcGIS Portal, Federated Environment , ESRI JS API and Angular snippets

Solution: IntelliJ not recognizing a particular file correctly, instead its stuck as a text file