diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-11-15 22:52:02 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-11-15 22:52:02 +0000 |
| commit | 36a247c66134c686acd78798adbc777717543a2a (patch) | |
| tree | 3a298ad7cac4aad6d7c8d3085c9458727f6201bb | |
| parent | 240d6b41a04f1d24f9bfe36d4da3a57512bb80de (diff) | |
| parent | 9d68b40cb9ea818c48152e6c712ff41586ad9653 (diff) | |
| download | keystone-36a247c66134c686acd78798adbc777717543a2a.tar.gz keystone-36a247c66134c686acd78798adbc777717543a2a.tar.xz keystone-36a247c66134c686acd78798adbc777717543a2a.zip | |
Merge "Ensures User is member of tenant in ec2 validation"
| -rw-r--r-- | keystone/contrib/ec2/core.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/keystone/contrib/ec2/core.py b/keystone/contrib/ec2/core.py index 5bf40103..064474c7 100644 --- a/keystone/contrib/ec2/core.py +++ b/keystone/contrib/ec2/core.py @@ -168,6 +168,16 @@ class Ec2Controller(wsgi.Application): context=context, user_id=user_ref['id'], tenant_id=tenant_ref['id']) + + # TODO(termie): optimize this call at some point and put it into the + # the return for metadata + # fill out the roles in the metadata + roles = metadata_ref.get('roles', []) + if not roles: + raise exception.Unauthorized(message='User not valid for tenant.') + roles_ref = [self.identity_api.get_role(context, role_id) + for role_id in roles] + catalog_ref = self.catalog_api.get_catalog( context=context, user_id=user_ref['id'], @@ -180,13 +190,6 @@ class Ec2Controller(wsgi.Application): tenant=tenant_ref, metadata=metadata_ref)) - # TODO(termie): optimize this call at some point and put it into the - # the return for metadata - # fill out the roles in the metadata - roles_ref = [] - for role_id in metadata_ref.get('roles', []): - roles_ref.append(self.identity_api.get_role(context, role_id)) - # TODO(termie): make this a util function or something # TODO(termie): i don't think the ec2 middleware currently expects a # full return, but it contains a note saying that it |
