本文整理汇总了PHP中Asset_host::is_allowed方法的典型用法代码示例。如果您正苦于以下问题:PHP Asset_host::is_allowed方法的具体用法?PHP Asset_host::is_allowed怎么用?PHP Asset_host::is_allowed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Asset_host
的用法示例。
在下文中一共展示了Asset_host::is_allowed方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_asset_tags
/**
* @param $conn
* @param $asset_id
*
* @return array
*/
function get_asset_tags($conn, $asset_id)
{
if (!Asset_host::is_allowed($conn, $asset_id)) {
$error = _('Asset Not Allowed');
Util::response_bad_request($error);
}
return get_tags($conn, $asset_id);
}
示例2: get_asset_groups
function get_asset_groups($conn, $asset_id)
{
if (!Asset_host::is_allowed($conn, $asset_id)) {
$error = _('Asset Not Allowed');
Util::response_bad_request($error);
}
try {
$asset = Asset_host::get_object($conn, $asset_id);
$num = $asset->get_num_group($conn);
} catch (Exception $e) {
$num = '-';
}
return $num;
}
示例3: validate_form_fields
$conn = $db->connect();
$validation_errors = validate_form_fields('POST', $validate);
switch ($action) {
case 'select_os':
$os_windows = POST('os_windows');
break;
case 'deploy_agent':
$sensor_id = POST('sensor_id');
$ip_address = POST('ip_address');
$user = POST('user');
$pass = POST('pass');
$domain = POST('domain');
//Extra validations
if (empty($validation_errors)) {
//Checking Asset ID
if (Asset_host::is_allowed($conn, $asset_id) == FALSE) {
$validation_errors['asset_id'] = _('You do not have permission to deploy HIDS agent to this asset. Please check with your account admin for more information');
}
//Checking HIDS Sensor
$cnd_1 = Ossec_utilities::is_sensor_allowed($conn, $sensor_id) == FALSE;
$asset_sensors = Asset_host_sensors::get_sensors_by_id($conn, $asset_id);
$cnd_2 = empty($asset_sensors[$sensor_id]);
if ($cnd_1 || $cnd_2) {
$validation_errors['sensor_id'] = sprintf(_("Sensor %s not allowed. Please check with your account admin for more information"), Av_sensor::get_name_by_id($conn, $sensor_id));
}
//Checking IP Address
$aux_asset_ips = Asset_host_ips::get_ips_to_string($conn, $asset_id);
if (preg_match('/' . $ip_address . '/', $aux_asset_ips) == FALSE) {
$validation_errors['ip_address'] = _("The IP address you enter is not valid. Please check your asset and network settings and try again");
}
}
示例4: AND
$inserts[] = "REPLACE INTO datawarehouse.ssi_user SELECT *,'{$user}' FROM datawarehouse.ssi \n WHERE 1 AND (source IN ('" . implode("','", array_keys($srcs)) . "') OR destination IN ('" . implode("','", array_keys($dsts)) . "'))";
$sql = "SELECT source, destination FROM datawarehouse.incidents_ssi WHERE 1 {$ips_filter}";
// AND month=$month
//echo $sql;
// INCIDENTS_SSI
if (!($rs =& $conn->Execute($sql))) {
Av_exception::throw_error(Av_exception::DB_ERROR, $conn->ErrorMsg());
}
// test perms for source or destination ips
while (!$rs->EOF) {
$ip_src = $rs->fields['source'];
$ip_dst = $rs->fields['destination'];
if (isset($srcs[$ip_src]) || Asset_host::is_allowed($conn, $ip_src)) {
$srcs[$ip_src]++;
}
if (isset($dsts[$ip_dst]) || Asset_host::is_allowed($conn, $ip_dst)) {
$dsts[$ip_dst]++;
}
$rs->MoveNext();
}
$inserts[] = "REPLACE INTO datawarehouse.incidents_ssi_user SELECT *,'{$user}' FROM datawarehouse.incidents_ssi \n WHERE 1 AND (source IN ('" . implode("','", array_keys($srcs)) . "') OR destination IN ('" . implode("','", array_keys($dsts)) . "'))";
} else {
$inserts[] = "REPLACE INTO datawarehouse.ssi_user SELECT *,'{$user}' FROM datawarehouse.ssi WHERE 1 {$ips_filter}";
$inserts[] = "REPLACE INTO datawarehouse.incidents_ssi_user SELECT *,'{$user}' FROM datawarehouse.incidents_ssi WHERE 1 {$ips_filter}";
}
// Delete first and fill only with permited data
$conn->Execute("DELETE FROM datawarehouse.ssi_user WHERE user = '{$user}'");
$conn->Execute("DELETE FROM datawarehouse.incidents_ssi_user WHERE user = '{$user}'");
foreach ($inserts as $insert) {
if (!$conn->Execute($insert)) {
Av_exception::throw_error(Av_exception::DB_ERROR, $conn->ErrorMsg());
示例5: GET
$asset_id = GET('asset_id');
$asset_type = GET('asset_type');
$response['session_updated'] = FALSE;
$reloaded = FALSE;
ossim_valid($asset_id, OSS_HEX, 'illegal: ' . _('Asset ID'));
ossim_valid($asset_type, OSS_ALPHA, 'illegal: ' . _('Asset Type'));
if (ossim_error()) {
echo json_encode($response);
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);