role_exists('ROLE_USER_STANDARD')) { $data[] = ['permission.permission_set', ['ROLE_USER_STANDARD', 'u_aps_view_build_other']]; $data[] = ['permission.permission_set', ['ROLE_USER_STANDARD', 'u_aps_view_logs_other']]; } if ($this->role_exists('ROLE_USER_FULL')) { $data[] = ['permission.permission_set', ['ROLE_USER_FULL', 'u_aps_view_build_other']]; $data[] = ['permission.permission_set', ['ROLE_USER_FULL', 'u_aps_view_logs_other']]; } return $data; } /** * Checks whether the given role does exist or not. * * @param string $role The name of the role * @return bool True if the role exists, false otherwise */ private function role_exists($role) { $sql = 'SELECT role_id FROM ' . ACL_ROLES_TABLE . ' WHERE role_name = "' . $this->db->sql_escape($role) . '"'; $result = $this->db->sql_query_limit($sql, 1); $role_id = $this->db->sql_fetchfield('role_id'); $this->db->sql_freeresult($result); return (bool) $role_id; } }