cli: add support for granting and revoking roles from users/teams

This commit is contained in:
Ryan Petrello
2019-08-30 09:07:14 -04:00
parent 276b577103
commit 6762702868
4 changed files with 151 additions and 2 deletions

View File

@@ -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)