Skip to content

Instantly share code, notes, and snippets.

@portante
Created June 10, 2014 12:44
Show Gist options
  • Select an option

  • Save portante/f309a917d2a70a3851af to your computer and use it in GitHub Desktop.

Select an option

Save portante/f309a917d2a70a3851af to your computer and use it in GitHub Desktop.
Small change on top of https://review.openstack.org/92165
diff --git a/swift/common/middleware/keystoneauth.py b/swift/common/middleware/keystoneauth.py
index fb15195..d5e3fb0 100644
--- a/swift/common/middleware/keystoneauth.py
+++ b/swift/common/middleware/keystoneauth.py
@@ -181,20 +181,20 @@ class KeystoneAuth(object):
return None
def authorize(self, env_identity, req):
- tenant_id, tenant_name = env_identity['tenant']
- user_id, user_name = env_identity['user']
- referrers, roles = swift_acl.parse_acl(getattr(req, 'acl', None))
-
- #allow OPTIONS requests to proceed as normal
- if req.method == 'OPTIONS':
- return
-
try:
part = req.split_path(1, 4, True)
version, account, container, obj = part
except ValueError:
return HTTPNotFound(request=req)
+ #allow OPTIONS requests to proceed as normal
+ if req.method == 'OPTIONS':
+ return
+
+ tenant_id, tenant_name = env_identity['tenant']
+ user_id, user_name = env_identity['user']
+ referrers, roles = swift_acl.parse_acl(getattr(req, 'acl', None))
+
user_roles = [r.lower() for r in env_identity.get('roles', [])]
# Give unconditional access to a user with the reseller_admin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment