$edit = Asset_host::can_i_modify_ips($conn, $id); $delete = Asset_host::can_delete($conn, $id); $local_assets = Asset_host::get_asset_by_system($conn, Util::get_system_uuid()); $p_plugin = Session::am_i_admin() && !$local_assets[$id]; $deploy_agent = Session::logcheck_bool('environment-menu', 'EventsHidsConfig'); } else { if (Asset_net::is_in_db($conn, $id)) { $asset_type = 'network'; Session::logcheck('environment-menu', 'PolicyNetworks'); $breadcrumb = array('section' => _('Networks'), 'current' => _('Network Details')); $edit = Asset_net::can_i_modify_ips($conn, $id); $delete = Asset_net::can_delete($conn, $id); $p_plugin = Session::am_i_admin(); $deploy_agent = FALSE; } else { if (Asset_group::is_in_db($conn, $id)) { $asset_type = 'group'; Session::logcheck('environment-menu', 'PolicyHosts'); $breadcrumb = array('section' => _('Groups'), 'current' => _('Group Details')); $gobj = new Asset_group($id); try { $edit = $gobj->can_i_edit($conn); } catch (Exception $err) { $edit = FALSE; } try { $delete = $gobj->can_delete_group($conn); } catch (Exception $err) { $delete = FALSE; } $p_plugin = Session::am_i_admin();
ossim_valid($scan_server, OSS_HEX, 'illegal:' . _("Sensor id")); if (ossim_error() && $scan_server != 'Null') { $error_message .= _('Sensor id') . ': ' . Util::htmlentities($scan_server) . '<br>'; } if (!empty($error_message)) { $config_nt = array('content' => $error_message, 'options' => array('type' => 'nf_error', 'cancel_button' => false), 'style' => 'width: 80%; margin: 20px auto; text-align: left;'); $nt = new Notification('nt_1', $config_nt); $nt->show(); exit(1); } } $db = new ossim_db(); $conn = $db->connect(); // get the groups members foreach ($assets_groups as $asset_id => $asset_type) { if ($asset_type == 'hostgroup' && Asset_group::is_in_db($conn, $asset_id)) { $host_group = Asset_group::get_object($conn, $asset_id); list($host_list, $total) = $host_group->get_hosts($conn); foreach ($host_list as $host_id => $host_data) { $host_ips = explode(',', $host_data['ips']); foreach ($host_ips as $host_ip) { $targets[$host_id . '#' . $host_ip] = array('hostgroup_id' => $asset_id); } } } else { if ($asset_type == 'netgroup' && Net_group::is_in_db($conn, $asset_id)) { $net_list = Net_group::get_networks($conn, $asset_id); foreach ($net_list as $net) { $net_id = $net->get_net_id(); $net_cidrs = Asset_net::get_ips_by_id($conn, $net_id); $cidrs = explode(',', $net_cidrs);
exit; } $db = new ossim_db(); $conn = $db->connect(); // Load the current asset object in session same as in index.php // Host if (Asset_host::is_in_db($conn, $asset_id)) { if (Asset_host::is_allowed($conn, $asset_id)) { $asset_object = Asset_host::get_object($conn, $asset_id); $reloaded = TRUE; } } elseif (Asset_net::is_in_db($conn, $asset_id)) { if (Asset_net::is_allowed($conn, $asset_id)) { $asset_object = Asset_net::get_object($conn, $asset_id); $reloaded = TRUE; } } elseif (Asset_group::is_in_db($conn, $asset_id)) { $asset_object = Asset_group::get_object($conn, $asset_id); $reloaded = TRUE; } // Save session object only if is already saved (it means the user has perms) if (!empty($_SESSION['asset_detail'][$asset_id]) && $reloaded) { $_SESSION['asset_detail'][$asset_id] = serialize($asset_object); $response['session_updated'] = TRUE; } else { $response['session_updated'] = FALSE; } echo json_encode($response); $db->close(); /* End of file reload_session_object.php */ /* Location: ./asset_details/ajax/reload_session_object.php */