Follow-up patch of bug: #1527457

The patch below was merged before addressing some comments from Akihiro.
https://review.openstack.org/#/c/259283/6
This patch will address them.

Change-Id: Iaf2aec3265a9f075f434ad5bce8ee6a2e3dd5fc5
Related-Bug: #1527457
This commit is contained in:
Kenji Ishii 2016-01-22 21:18:38 +09:00
parent 4b5886d276
commit ad6c1410e6
4 changed files with 7 additions and 6 deletions

View File

@ -353,11 +353,10 @@ class UpdateDomain(workflows.Workflow, IdentityMixIn):
# domain_id == request.user.domain_id # domain_id == request.user.domain_id
is_current_domain = True is_current_domain = True
_admin_roles = self.get_admin_roles() available_admin_role_ids = [
available_admin_role_ids = [role.id for role in role.id for role in available_roles
available_roles if role.name.lower() in self.get_admin_roles()
if role.name.lower() in ]
_admin_roles]
admin_role_ids = [role for role in current_role_ids admin_role_ids = [role for role in current_role_ids
if role in available_admin_role_ids] if role in available_admin_role_ids]
if len(admin_role_ids): if len(admin_role_ids):

View File

@ -1766,6 +1766,7 @@ class SeleniumTests(test.SeleniumAdminTestCase):
for user in users: for user in users:
self.assertIn(user.name, members.text) self.assertIn(user.name, members.text)
@override_settings(OPENSTACK_KEYSTONE_ADMIN_ROLES=['foO', 'BAR', 'admin'])
def test_get_admin_roles(self): def test_get_admin_roles(self):
mix_in = workflows.IdentityMixIn() mix_in = workflows.IdentityMixIn()
admin_roles = mix_in.get_admin_roles() admin_roles = mix_in.get_admin_roles()

View File

@ -232,4 +232,3 @@ REST_API_SETTING_2 = 'bar'
REST_API_SECURITY = 'SECURITY' REST_API_SECURITY = 'SECURITY'
REST_API_REQUIRED_SETTINGS = ['REST_API_SETTING_1'] REST_API_REQUIRED_SETTINGS = ['REST_API_SETTING_1']
REST_API_ADDITIONAL_SETTINGS = ['REST_API_SETTING_2'] REST_API_ADDITIONAL_SETTINGS = ['REST_API_SETTING_2']
OPENSTACK_KEYSTONE_ADMIN_ROLES = ['foO', 'BAR', 'admin']

View File

@ -14,6 +14,7 @@
# under the License. # under the License.
import datetime import datetime
from django.test.utils import override_settings
import uuid import uuid
from openstack_dashboard.test import helpers as test from openstack_dashboard.test import helpers as test
@ -67,6 +68,7 @@ class UtilsMeteringTests(test.TestCase):
class IdentityTests(test.BaseAdminViewTests): class IdentityTests(test.BaseAdminViewTests):
@override_settings(OPENSTACK_KEYSTONE_ADMIN_ROLES=['foO', 'BAR', 'admin'])
def test_get_admin_roles(self): def test_get_admin_roles(self):
mix_in = identity.IdentityMixIn() mix_in = identity.IdentityMixIn()
admin_roles = mix_in.get_admin_roles() admin_roles = mix_in.get_admin_roles()