mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 01:17:37 -02:30
allow org admins to share credentials between orgs
This commit is contained in:
@@ -837,15 +837,7 @@ class CredentialAccess(BaseAccess):
|
|||||||
def can_change(self, obj, data):
|
def can_change(self, obj, data):
|
||||||
if not obj:
|
if not obj:
|
||||||
return False
|
return False
|
||||||
|
return self.user in obj.admin_role and self.check_related('organization', Organization, data, obj=obj)
|
||||||
# Cannot change the organization for a credential after it's been created
|
|
||||||
if data and 'organization' in data:
|
|
||||||
organization_pk = get_pk_from_dict(data, 'organization')
|
|
||||||
if (organization_pk and (not obj.organization or organization_pk != obj.organization.id)) \
|
|
||||||
or (not organization_pk and obj.organization):
|
|
||||||
return False
|
|
||||||
|
|
||||||
return self.user in obj.admin_role
|
|
||||||
|
|
||||||
def can_delete(self, obj):
|
def can_delete(self, obj):
|
||||||
# Unassociated credentials may be marked deleted by anyone, though we
|
# Unassociated credentials may be marked deleted by anyone, though we
|
||||||
|
|||||||
Reference in New Issue
Block a user