SELECT rog_group_id AS group_id,
GROUP_CONCAT(rog_role_id) AS role_ids_concat, -- debug only
GROUP_CONCAT(IF(rog_read,1,0)) AS rog_reads_concat, -- debug only
GROUP_CONCAT(IF(rog_write,1,0)) AS rog_writes_concat, -- debug only
MAX(rog_read) AS group_readonly,
MAX(rog_read) AS group_read,
MAX(rog_write) AS group_write
FROM usm_roles_on_groups
WHERE rog_role_id IN (:role_ids)
GROUP BY rog_group_id
