mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 16:51:11 +03:00
fix a bug that prevents unpriveleged users from listing CredentialTypes
see: #6737
This commit is contained in:
parent
70c11879a4
commit
b0e51b42d8
@ -899,6 +899,9 @@ class CredentialTypeAccess(BaseAccess):
|
|||||||
return False
|
return False
|
||||||
return super(CredentialTypeAccess, self).get_method_capability(method, obj, parent_obj)
|
return super(CredentialTypeAccess, self).get_method_capability(method, obj, parent_obj)
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
return self.model.objects.all()
|
||||||
|
|
||||||
|
|
||||||
class CredentialAccess(BaseAccess):
|
class CredentialAccess(BaseAccess):
|
||||||
'''
|
'''
|
||||||
|
@ -14,16 +14,20 @@ def test_list_as_unauthorized_xfail(get):
|
|||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_list_as_normal_user(get, alice):
|
def test_list_as_normal_user(get, alice):
|
||||||
|
ssh = CredentialType.defaults['ssh']()
|
||||||
|
ssh.save()
|
||||||
response = get(reverse('api:credential_type_list'), alice)
|
response = get(reverse('api:credential_type_list'), alice)
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert response.data['count'] == 0
|
assert response.data['count'] == 1
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_list_as_admin(get, admin):
|
def test_list_as_admin(get, admin):
|
||||||
|
ssh = CredentialType.defaults['ssh']()
|
||||||
|
ssh.save()
|
||||||
response = get(reverse('api:credential_type_list'), admin)
|
response = get(reverse('api:credential_type_list'), admin)
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert response.data['count'] == 0
|
assert response.data['count'] == 1
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
|
Loading…
Reference in New Issue
Block a user