Skip to content

Commit

Permalink
Add admin role to see hidden resources
Browse files Browse the repository at this point in the history
Add admin role to:

- local keystone auth API
- default auth service

to be able to see hidden resources.

Change-Id: I7e7e8cb29ae105702c7680fa7ab9fb1303ca671c
Partial-Bug: #1377139
  • Loading branch information
Édouard Thuleau committed Oct 3, 2014
1 parent 52c5e05 commit 024279e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/config/api-server/vnc_auth_keystone.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ def local_auth_check(*args, **kwargs):
if (not self._conf_info.get('admin_user') == user or
not self._conf_info.get('admin_password') == passwd):
bottle.abort(401, 'Authentication check failed')

# Add admin role to the request
bottle.request.environ['HTTP_X_ROLE'] = 'admin'
# end __init__

def start_http_server(self):
Expand Down
9 changes: 9 additions & 0 deletions src/config/api-server/vnc_cfg_api_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,15 @@ def __init__(self, args_str=None):
self._pipe_start_app = auth_svc.get_middleware_app()
if not self._pipe_start_app:
self._pipe_start_app = bottle.app()
# When the multi tenancy is disable, add 'admin' role into the
# header for all requests to see all resources
@self._pipe_start_app.hook('before_request')
@bottle.hook('before_request')
def set_admin_role(*args, **kwargs):
if bottle.request.app != self._pipe_start_app:
return
bottle.request.environ['HTTP_X_ROLE'] = 'admin'

self._auth_svc = auth_svc

# API/Permissions check
Expand Down

0 comments on commit 024279e

Please sign in to comment.