Skip to content

Commit

Permalink
Honor keystone policy file when creating client
Browse files Browse the repository at this point in the history
When creating the keystone client for an admin the user is checked
for the specific role of "admin" to determine if they are authorized
to use the admin URL. This patch changes this logic so that the
policy file is honored instead of a specific role.

Closes-Bug: #1336418
Change-Id: I600334dff17a5564f97cbcce67ff6d3619142961
  • Loading branch information
jrpomeroy committed Nov 6, 2014
1 parent 9f904e3 commit 45ae78c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion openstack_dashboard/api/keystone.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from horizon.utils import functions as utils

from openstack_dashboard.api import base
from openstack_dashboard import policy


LOG = logging.getLogger(__name__)
Expand Down Expand Up @@ -143,7 +144,7 @@ def keystoneclient(request, admin=False):
"""
user = request.user
if admin:
if not user.is_superuser:
if not policy.check(("identity", "admin_required"), request):
raise exceptions.NotAuthorized
endpoint_type = 'adminURL'
else:
Expand Down

0 comments on commit 45ae78c

Please sign in to comment.