mirror of
https://github.com/ansible/awx.git
synced 2026-02-01 01:28:09 -03:30
Working on credentials API
This commit is contained in:
@@ -538,10 +538,16 @@ class Credential(CommonModelNameNotUnique):
|
||||
return True
|
||||
if user == obj.user:
|
||||
return True
|
||||
if obj.user and (obj.user.organizations.filter(admins__in = [user]).count()):
|
||||
return True
|
||||
if obj.team and (user in obj.team.organization.admins.all()):
|
||||
return True
|
||||
|
||||
if obj.user:
|
||||
print "user orgs = " , obj.user.organizations.all()
|
||||
print "user org admins = " , [ x.admins.all() for x in obj.user.organizations.all() ]
|
||||
if (obj.user.organizations.filter(admins__in = [user]).count()):
|
||||
return True
|
||||
if obj.team:
|
||||
print "ADMINS OF TEAM=%s" % obj.team.organization.admins.all()
|
||||
if user in obj.team.organization.admins.all():
|
||||
return True
|
||||
return False
|
||||
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user