mirror of
https://github.com/ansible/awx.git
synced 2026-09-04 19:08:30 -02:30
fix bug where cred org permission was not checked
This commit is contained in:
committed by
Ryan Petrello
parent
43d816b6e4
commit
4831cde39f
@@ -74,6 +74,19 @@ def test_org_credential_access_admin(role_name, alice, org_credential):
|
||||
'organization': org_credential.organization.pk})
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_org_and_user_credential_access(alice, organization):
|
||||
"""Address specific bug where any user could make an org credential
|
||||
in another org without any permissions to that org
|
||||
"""
|
||||
# Owner is both user and org, but org permission should still be checked
|
||||
assert not CredentialAccess(alice).can_add({
|
||||
'name': 'New credential.',
|
||||
'user': alice.pk,
|
||||
'organization': organization.pk
|
||||
})
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_org_credential_access_member(alice, org_credential):
|
||||
org_credential.admin_role.members.add(alice)
|
||||
|
||||
Reference in New Issue
Block a user