mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 09:51:09 +03:00
fix related fields to include team and user
This commit is contained in:
parent
963ce41851
commit
e6210de7b2
@ -1627,9 +1627,13 @@ class CredentialSerializer(BaseSerializer):
|
|||||||
access_list = reverse('api:credential_access_list', args=(obj.pk,)),
|
access_list = reverse('api:credential_access_list', args=(obj.pk,)),
|
||||||
))
|
))
|
||||||
|
|
||||||
qs = Organization.objects.filter(admin_role__children=obj.owner_role)
|
parents = obj.owner_role.parents.exclude(object_id__isnull=True)
|
||||||
if qs.count() > 0:
|
if parents.count() > 0:
|
||||||
res.update(dict(organization=qs[0].get_absolute_url()))
|
res.update({parents[0].content_type.name:parents[0].content_object.get_absolute_url()})
|
||||||
|
elif obj.owner_role.members.count() > 0:
|
||||||
|
user = obj.owner_role.members.first()
|
||||||
|
res.update({'user': reverse('api:user_detail', args=(user.pk,))})
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def get_summary_fields(self, obj):
|
def get_summary_fields(self, obj):
|
||||||
|
Loading…
Reference in New Issue
Block a user