AnsweredAssumed Answered

Users search by Group name?

Question asked by ascullyCOT on Apr 10, 2019
Latest reply on Apr 15, 2019 by ascullyCOT

We have a new Portal site, need to copy users from an existing Portal, but only a subset of users, who belong to a specific group in the existing Portal.

 

Using the code samples provided, I have it mostly ready to run in Jupyter Notebooks (figured out how to make it work for Active Directory accounts), but I can't seem to have the users.search be filtered/queried for a specific group.  The example I'm working from has a query to filter out certain users, which is nice, but I'm not sure how to/if you can change that filter to reference a group:

 

source_users = source.users.search('!esri_ & !admin')
for user in source_users:   
   print(user.username + "\t:\t" + str(user.role))

So what I'd like is to have something like (i know 'groupname' is not a real thing, this is just get the idea across):

source_users = source.users.search('groupname: My Group')
for user in source_users:   
   print(user.username + "\t:\t" + str(user.role))

Thanks - 

Allen

Outcomes