Handling Forbidden Exception

This patch adds forbidden exception for all_tenants
and edit_managed attributes.

Change-Id: I7a160abee99cc787f18593cba5c9e33485a85239
Closes-Bug: #1486709
This commit is contained in:
hardik 2015-09-14 15:59:07 +05:30
parent f329a813aa
commit f51ce40034
1 changed files with 10 additions and 7 deletions

View File

@ -144,13 +144,16 @@ class KeystoneContextMiddleware(ContextMiddleware):
roles = headers.get('X-Roles').split(',')
self.make_context(
request,
auth_token=headers.get('X-Auth-Token'),
user=headers.get('X-User-ID'),
tenant=tenant_id,
roles=roles,
service_catalog=catalog)
try:
self.make_context(
request,
auth_token=headers.get('X-Auth-Token'),
user=headers.get('X-User-ID'),
tenant=tenant_id,
roles=roles,
service_catalog=catalog)
except exceptions.Forbidden:
return flask.Response(status=403)
class NoAuthContextMiddleware(ContextMiddleware):