fix bug where cred org permission was not checked

This commit is contained in:
AlanCoding
2019-03-20 15:03:18 -04:00
committed by Ryan Petrello
parent 43d816b6e4
commit 4831cde39f
2 changed files with 23 additions and 5 deletions

View File

@@ -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)