Let admin can delete user's environment

Now admin can see the list of user's environments,
but can't delete them. There will gives the 403 Forbidden.
This patch let admin can delete user's environment.

Change-Id: Ic208ae586427bb3eb9ce4749870158ccdfb09d76
Closes-Bug: #1654103
This commit is contained in:
zhurong 2017-01-05 15:31:30 +08:00
parent 2eb086769f
commit 5470550b5e
2 changed files with 6 additions and 1 deletions

View File

@ -40,7 +40,8 @@ def check_env(request, environment_id):
raise exc.HTTPNotFound(explanation=msg)
if hasattr(request, 'context'):
if environment.tenant_id != request.context.tenant:
if (environment.tenant_id != request.context.tenant and not
request.context.is_admin):
msg = _('User is not authorized to access'
' these tenant resources')
LOG.error(msg)

View File

@ -0,0 +1,4 @@
---
fixes:
- |
Now admin can delete user's environments.