From 5470550b5e3217dec5e0427f3645ef9e1dbeb9d0 Mon Sep 17 00:00:00 2001 From: zhurong Date: Thu, 5 Jan 2017 15:31:30 +0800 Subject: [PATCH] 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 --- murano/utils.py | 3 ++- releasenotes/notes/bug-1654103-f39ee721d1b90b68.yaml | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/bug-1654103-f39ee721d1b90b68.yaml diff --git a/murano/utils.py b/murano/utils.py index 5df1fe46..7cae9258 100644 --- a/murano/utils.py +++ b/murano/utils.py @@ -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) diff --git a/releasenotes/notes/bug-1654103-f39ee721d1b90b68.yaml b/releasenotes/notes/bug-1654103-f39ee721d1b90b68.yaml new file mode 100644 index 00000000..c4c0c1d4 --- /dev/null +++ b/releasenotes/notes/bug-1654103-f39ee721d1b90b68.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - | + Now admin can delete user's environments.