mirror of
https://github.com/ansible/awx.git
synced 2026-05-20 23:37:39 -02:30
cli: add support for granting and revoking roles from users/teams
This commit is contained in:
@@ -41,6 +41,10 @@ def pk_or_name(v2, model_name, value, page=None):
|
||||
page = getattr(v2, model_name)
|
||||
|
||||
if page:
|
||||
if model_name == 'users':
|
||||
identity = 'username'
|
||||
elif model_name == 'instances':
|
||||
model_name = 'hostname'
|
||||
results = page.get(**{identity: value})
|
||||
if results.count == 1:
|
||||
return int(results.results[0].id)
|
||||
|
||||
Reference in New Issue
Block a user