当前位置: 首页>>代码示例>>PHP>>正文


PHP Asset_host::can_i_modify_ips方法代码示例

本文整理汇总了PHP中Asset_host::can_i_modify_ips方法的典型用法代码示例。如果您正苦于以下问题:PHP Asset_host::can_i_modify_ips方法的具体用法?PHP Asset_host::can_i_modify_ips怎么用?PHP Asset_host::can_i_modify_ips使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Asset_host的用法示例。


在下文中一共展示了Asset_host::can_i_modify_ips方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: import_assets_from_csv


//.........这里部分代码省略.........
        } else {
            $aux_name = str_replace(' ', '', $csv_ips);
            $aux_name = str_replace(',', '-', $aux_name);
            $name = Asset_host::get_autodetected_name($aux_name);
        }
        if ($import_type == 'hosts') {
            $fqdns = $param[2];
            $descr = $param[3];
            $asset_value = !empty($param[4]) ? $param[4] : 2;
            if (preg_match('/Host ID/', $csv_headers[8])) {
                $os = $param[5];
                $latitude = floatval($param[6]);
                $longitude = floatval($param[7]);
                $external = empty($param[9]) ? 0 : intval($param[9]);
                $csv_devices = $param[10];
            } else {
                $os = $param[6];
                $latitude = floatval($param[7]);
                $longitude = floatval($param[8]);
                $external = 0;
                $csv_devices = '';
            }
        } else {
            $descr = $param[2];
            $os = $param[3];
            $latitude = 0;
            $longitude = 0;
            $asset_value = 2;
            $external = 0;
            $csv_devices = $param[4];
        }
        //Permissions
        $can_i_create_assets = Session::can_i_create_assets();
        $can_i_modify_ips = TRUE;
        //IPs
        if (!ossim_valid($csv_ips, OSS_IP_ADDR, 'illegal:' . _('IP'))) {
            $summary['by_hosts'][$num_line]['errors']['IP'] = ossim_get_error_clean();
            $summary['general']['statistics']['errors']++;
            continue;
        }
        //Check Host ID: Is there a host registered in the System?
        $host_ids = Asset_host::get_id_by_ips($conn, $csv_ips, $ctx);
        $host_id = key($host_ids);
        if (!empty($host_id)) {
            $is_in_db = TRUE;
        } else {
            $host_id = Util::uuid();
        }
        // Special case: Forced Host ID [Version 4.x.x or higher]
        if ($import_type == 'hosts' && preg_match('/Host ID/', $csv_headers[8]) && valid_hex32($param[8])) {
            $csv_hosts_id = strtoupper($param[8]);
            if ($is_in_db == TRUE && $csv_hosts_id != $host_id) {
                $id_error_msg = _('Host is already registered in the System with another Host ID');
                $summary['by_hosts'][$num_line]['errors']['Host'] = $id_error_msg;
                $summary['general']['statistics']['errors']++;
                continue;
            } else {
                if ($is_in_db == FALSE) {
                    $host_id = $csv_hosts_id;
                    // Save host ID to insert it
                }
            }
        }
        //Hostname
        if (!empty($iic)) {
            $name = clean_iic($name);
开发者ID:jackpf,项目名称:ossim-arc,代码行数:67,代码来源:import_all_hosts.php

示例2: unset

         }
     } else {
         unset($_ip);
         unset($_ctx);
     }
 }
 if (!empty($id) && Asset_host::is_in_db($conn, $id)) {
     ossim_valid($id, OSS_HEX, 'illegal:' . _('Asset ID'));
     if (ossim_error()) {
         echo ossim_error(_('Error! Asset not found'));
         exit;
     }
     $asset = new Asset_host($conn, $id);
     $asset->load_from_db($conn);
     $is_in_db = 1;
     $is_editable = Asset_host::can_i_modify_ips($conn, $id) ? 'yes' : 'no_ip';
 } else {
     //New asset or asset has been deleted but there are some instances in the system (SIEM, alarms, ...)
     $id = valid_hex32($id) ? $id : Util::uuid();
     $asset = new Asset_host($conn, $id);
     if (isset($_ip) && isset($_ctx)) {
         $asset->set_ctx($_ctx);
         $ext_ips[$_ip] = array('ip' => $_ip, 'mac' => NULL);
         $asset->set_ips($ext_ips);
     }
 }
 //Getting asset data
 $id = $asset->get_id();
 $ctx = $asset->get_ctx();
 $_ips = $asset->get_ips();
 $ips = $_ips->get_ips();
开发者ID:jackpf,项目名称:ossim-arc,代码行数:31,代码来源:asset_form.php

示例3: switch

if (ossim_error()) {
    Util::response_bad_request(ossim_get_error_clean());
}
$app_name = Session::is_pro() ? 'AlienVault' : 'OSSIM';
switch ($action) {
    case 'delete_asset':
        //Validate Form token
        $token = POST('token');
        if (Token::verify('tk_asset_form', $token) == FALSE) {
            $error = Token::create_error_message();
            Util::response_bad_request($error);
        }
        $asset_id = POST('asset_id');
        $db = new ossim_db();
        $conn = $db->connect();
        $can_i_modify_ips = Asset_host::can_i_modify_ips($conn, $asset_id);
        $db->close();
        if (!valid_hex32($asset_id) || $can_i_modify_ips == FALSE) {
            Util::response_bad_request(_('Error! Asset ID not allowed.  Asset could not be deleted'));
        } else {
            try {
                $db = new ossim_db();
                $conn = $db->connect();
                Asset_host::delete_from_db($conn, $asset_id, TRUE);
                $db->close();
                $data['status'] = 'success';
                $data['data'] = sprintf(_('Asset has been permanently deleted from %s'), $app_name);
            } catch (Exception $e) {
                Util::response_bad_request(_('Error! Asset could not be deleted') . ': ' . $e->getMessage());
            }
        }
开发者ID:jackpf,项目名称:ossim-arc,代码行数:31,代码来源:asset_actions.php

示例4: GET

require_once 'av_init.php';
$id = GET('asset_id');
$section = GET('section');
ossim_valid($id, OSS_HEX, 'illegal:' . _('Asset ID'));
ossim_valid($section, OSS_ALPHA, OSS_NULLABLE, 'illegal:' . _('Asset Section'));
if (ossim_error()) {
    die(ossim_error());
}
// Database Object
$db = new ossim_db();
$conn = $db->connect();
if (Asset_host::is_in_db($conn, $id)) {
    $asset_type = 'asset';
    Session::logcheck('environment-menu', 'PolicyHosts');
    $breadcrumb = array('section' => _('Assets'), 'current' => _('Asset Details'));
    $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)) {
开发者ID:jackpf,项目名称:ossim-arc,代码行数:31,代码来源:detail.php


注:本文中的Asset_host::can_i_modify_ips方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。