Merge "Fix case of admin role in middleware."

This commit is contained in:
Jenkins 2012-02-25 04:52:19 +00:00 committed by Gerrit Code Review
commit 99575a0465
3 changed files with 4 additions and 4 deletions

View File

@ -340,7 +340,7 @@ class AuthProtocol(object):
role_refs = token_info['access']['user']['roles']
if role_refs != None:
for role_ref in role_refs:
# Nova looks for the non case-sensitive role 'Admin'
# Nova looks for the non case-sensitive role 'admin'
# to determine admin-ness
roles.append(role_ref['name'])

View File

@ -55,7 +55,7 @@ class KeystoneContextMiddleware(context.ContextMiddleware):
user = req.headers.get('X_USER')
tenant = req.headers.get('X_TENANT')
roles = [r.strip() for r in req.headers.get('X_ROLE', '').split(',')]
is_admin = 'Admin' in roles
is_admin = 'admin' in roles
# Construct the context
req.context = self.make_context(auth_tok=auth_tok,

View File

@ -67,7 +67,7 @@ class KeystoneAuthShim(wsgi.Middleware):
# FIXME: keystone-admin-role value from keystone.conf is not
# used neither here nor in glance_auth_token!
roles = [r.strip() for r in req.headers.get('X_ROLE', '').split(',')]
is_admin = 'Admin' in roles
is_admin = 'admin' in roles
if user_ref.is_admin() != is_admin:
self.auth.modify_user(user_ref, admin=is_admin)
@ -96,7 +96,7 @@ class KeystoneAuthShim(wsgi.Middleware):
# Build a context, including the auth_token...
ctx = context.RequestContext(user_id, project_id,
is_admin=('Admin' in roles),
is_admin=('admin' in roles),
auth_token=auth_token)
req.environ['nova.context'] = ctx