Merge "Honor keystone policy file when creating client"
This commit is contained in:
commit
ff09b75886
|
@ -34,6 +34,7 @@ from horizon import messages
|
||||||
from horizon.utils import functions as utils
|
from horizon.utils import functions as utils
|
||||||
|
|
||||||
from openstack_dashboard.api import base
|
from openstack_dashboard.api import base
|
||||||
|
from openstack_dashboard import policy
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
@ -143,7 +144,7 @@ def keystoneclient(request, admin=False):
|
||||||
"""
|
"""
|
||||||
user = request.user
|
user = request.user
|
||||||
if admin:
|
if admin:
|
||||||
if not user.is_superuser:
|
if not policy.check(("identity", "admin_required"), request):
|
||||||
raise exceptions.NotAuthorized
|
raise exceptions.NotAuthorized
|
||||||
endpoint_type = 'adminURL'
|
endpoint_type = 'adminURL'
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue