SELECT
'id', user.id,
'username', user.username,
'roles', json_arrayagg(role.title) roles
FROM user
JOIN project_user on user.id = project_user.user_id
JOIN role on project_user.role_id = role.id
LEFT JOIN access_component_user ON user.id = access_component_user.user_id
WHERE project_user.project_id = $project_id AND user.id != $user_id
GROUP BY project_user.user_id, project_user.project_id, access_component_user.user_id
roles: "[\"Координатор\", \"Координатор\", \"Супервайзер\", \"Супервайзер\"]"