Last active
November 19, 2019 18:20
-
-
Save ppeiris/27fda75ed9e792d1e73bc1274f157c97 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
args: | |
- users | |
- user_roles | |
""" | |
def get_user_roles(self, users, user_roles={}): | |
for user in users: | |
if user in user_roles: | |
continue | |
self.connection.set_url(f'/api/mo/sys/userext/user-{user}.json?rsp-subtree=full') | |
self.connection.get() | |
role = self.connection.get_response_json() | |
role_name = role['imdata'][0]['aaaUser'] | |
['children'][0]['aaaUserDomain']['children'][0]['aaaUserRole']['attributes']['name'] | |
user_roles.update({user: role_name}) | |
return user_roles |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment