} if ($html != "") { $buffer .= preg_replace("/,\$/", "", $html); } $buffer .= "]"; if ($buffer == "" || $buffer == "[]") { $buffer = "[{title:'" . _("No Hosts Found") . "', noLink:true}]"; } echo $buffer; } else { if (preg_match("/u_(.*)_netgroup/", $key, $found)) { $j = 0; $netgroup_list = Net_group::get_list($conn); $buffer .= "["; foreach ($netgroup_list as $netgroup) { if (Session::groupAllowed($conn, $netgroup->get_name(), $found[1])) { $ng_name = $netgroup->get_name(); $ng_title = Util::htmlentities($ng_name); $title = strlen($ng_name) > $length_name ? substr($ng_name, 0, $length_name) . "..." : $ng_name; $title = Util::htmlentities($title); $tooltip = $ng_title; $li = "h:'{$h}', url:'../net/newnetgroupform.php?name=" . urlencode($ng_name) . "', icon:'../../pixmaps/theme/net_group.png', title:'{$title}', tooltip:'{$tooltip}'\n"; $buffer .= ($j > 0 ? "," : "") . "{ {$li} }"; $j++; } } $buffer .= "]"; if ($buffer == "[]") { $buffer = "[{title:'" . _("No Network Groups Found") . "', noLink:true}]"; } echo $buffer;
function is_indicator_allowed($conn, $type, $asset_id) { $has_perm = 1; if (Session::am_i_admin()) { return $has_perm; } if ($type == 'host') { $has_perm = Session::hostAllowed($conn, $asset_id); } elseif ($type == 'sensor' || $type == 'server') { $has_perm = Session::sensorAllowed($asset_id); } elseif ($type == 'net') { $has_perm = Session::netAllowed($conn, $asset_id); } elseif ($type == 'host_group' || $type == 'hostgroup') { $has_perm = Session::groupHostAllowed($conn, $asset_id); } elseif ($type == 'net_group' || $type == 'netgroup') { $has_perm = Session::groupAllowed($conn, $asset_id); } return $has_perm; }