mirror of
https://github.com/ansible/awx.git
synced 2026-05-10 10:57:35 -02:30
Merge pull request #3238 from jangsutsr/3088_make_admin_visible_to_oprhaned_users
Make system admin and system auditor visible to oprhaned users.
This commit is contained in:
@@ -381,7 +381,7 @@ class Role(models.Model):
|
||||
'ancestors_table': Role.ancestors.through._meta.db_table,
|
||||
'parents_table': Role.parents.through._meta.db_table,
|
||||
'roles_table': Role._meta.db_table,
|
||||
'ids': ','.join(str(x) for x in user.roles.values_list('id', flat=True))
|
||||
'ids': ','.join(str(x) for x in user.roles.values_list('id', flat=True)),
|
||||
}
|
||||
|
||||
qs = Role.objects.extra(
|
||||
|
||||
13
awx/main/tests/functional/api/test_role.py
Normal file
13
awx/main/tests/functional/api/test_role.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import pytest
|
||||
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_admin_visible_to_orphaned_users(get, alice):
|
||||
names = set()
|
||||
|
||||
response = get(reverse('api:role_list'), user=alice)
|
||||
for item in response.data['results']:
|
||||
names.add(item['name'])
|
||||
assert 'System Auditor' in names
|
||||
assert 'System Administrator' in names
|
||||
Reference in New Issue
Block a user