mirror of
https://github.com/ansible/awx.git
synced 2026-03-04 18:21:03 -03:30
Fixing Credential access issue
This commit is contained in:
@@ -586,19 +586,21 @@ class CredentialAccess(BaseAccess):
|
|||||||
if organization_pk:
|
if organization_pk:
|
||||||
organization_obj = get_object_or_400(Organization, pk=organization_pk)
|
organization_obj = get_object_or_400(Organization, pk=organization_pk)
|
||||||
return check_user_access(self.user, Organization, 'change', organization_obj, None)
|
return check_user_access(self.user, Organization, 'change', organization_obj, None)
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
@check_superuser
|
@check_superuser
|
||||||
def can_use(self, obj):
|
def can_use(self, obj):
|
||||||
return self.user in obj.use_role
|
return self.user in obj.use_role
|
||||||
|
|
||||||
@check_superuser
|
@check_superuser
|
||||||
def can_change(self, obj, data):
|
def can_change(self, obj, data):
|
||||||
if self.user in obj.owner_role:
|
if data is not None:
|
||||||
return True
|
keys = data.keys()
|
||||||
return self.can_add(data)
|
if 'user' in keys or 'team' in keys or 'organization' in keys:
|
||||||
|
if not self.can_add(data):
|
||||||
|
return False
|
||||||
|
|
||||||
|
return self.user in obj.owner_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