diff options
author | Kristi Nikolla <knikolla@bu.edu> | 2017-06-16 11:30:56 -0400 |
---|---|---|
committer | Kristi Nikolla <knikolla@bu.edu> | 2017-06-16 11:30:56 -0400 |
commit | ef49844248661671063567f98016e88943955ba0 (patch) | |
tree | 0679ca79ad63058554d0ac00bc10c3f6aabc49d7 /keystoneclient/v3 | |
parent | 2ab7f6df1207f2da38fa893518228a695aea8ecd (diff) | |
download | python-keystoneclient-ef49844248661671063567f98016e88943955ba0.tar.gz |
Add support for specifying role ids when creating trust
Change-Id: I38e0ac35946ee6e53128babac3ea759a380572e0
Partial-Bug: 1696111
Diffstat (limited to 'keystoneclient/v3')
-rw-r--r-- | keystoneclient/v3/contrib/trusts.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/keystoneclient/v3/contrib/trusts.py b/keystoneclient/v3/contrib/trusts.py index e236188..a8ef579 100644 --- a/keystoneclient/v3/contrib/trusts.py +++ b/keystoneclient/v3/contrib/trusts.py @@ -39,13 +39,14 @@ class TrustManager(base.CrudManager): base_url = '/OS-TRUST' def create(self, trustee_user, trustor_user, role_names=None, - project=None, impersonation=False, expires_at=None, - remaining_uses=None, **kwargs): + role_ids=None, project=None, impersonation=False, + expires_at=None, remaining_uses=None, **kwargs): """Create a Trust. :param string trustee_user: user who is capable of consuming the trust :param string trustor_user: user who's authorization is being delegated :param string role_names: subset of trustor's roles to be granted + :param string role_ids: subset of trustor's roles to be granted :param string project: project which the trustor is delegating :param boolean impersonation: enable explicit impersonation :param datetime.datetime expires_at: expiry time @@ -55,9 +56,13 @@ class TrustManager(base.CrudManager): """ # Convert role_names list into list-of-dict API format + roles = [] if role_names: - roles = [{'name': n} for n in role_names] - else: + roles.extend([{'name': n} for n in role_names]) + if role_ids: + roles.extend([{'id': i} for i in role_ids]) + + if not roles: roles = None # Convert datetime.datetime expires_at to iso format string |