mirror of
https://github.com/ZwareBear/awx.git
synced 2026-05-03 21:31:56 -05:00
fix bug where user content_object has no name attribute in access_list
This commit is contained in:
@@ -1581,10 +1581,13 @@ class ResourceAccessListElementSerializer(UserSerializer):
|
||||
|
||||
def format_role_perm(role):
|
||||
role_dict = { 'id': role.id, 'name': role.name, 'description': role.description}
|
||||
if role.content_type is not None:
|
||||
try:
|
||||
role_dict['resource_name'] = role.content_object.name
|
||||
role_dict['resource_type'] = role.content_type.name
|
||||
role_dict['related'] = reverse_gfk(role.content_object)
|
||||
except:
|
||||
pass
|
||||
if role.content_type is not None:
|
||||
role_dict['user_capabilities'] = {'unattach': requesting_user.can_access(
|
||||
Role, 'unattach', role, user, 'members', data={}, skip_sub_obj_read_check=False)}
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user