case 'delete_net': $validate = array('asset_id' => array('validation' => 'OSS_HEX', 'e_message' => 'illegal:' . _('Host ID'))); $net_id = POST('asset_id'); $validation_errors = validate_form_fields('POST', $validate); $db = new ossim_db(); $conn = $db->connect(); $can_i_modify_ips = Asset_net::can_i_modify_ips($conn, $net_id); $db->close(); if (is_array($validation_errors) && !empty($validation_errors) || $can_i_modify_ips == FALSE) { $data['status'] = 'error'; $data['data'] = _('Error! Net ID not allowed. Net could not be removed'); } else { try { $db = new ossim_db(); $conn = $db->connect(); Asset_net::delete_from_db($conn, $net_id, TRUE); $db->close(); $data['status'] = 'OK'; $data['data'] = _('Net removed successfully'); } catch (Exception $e) { $data['status'] = 'error'; $data['data'] = _('Error! Net could not be removed'); } } break; case 'remove_icon': $validate = array('asset_id' => array('validation' => 'OSS_HEX', 'e_message' => 'illegal:' . _('Net ID'))); $net_id = POST('asset_id'); $validation_errors = validate_form_fields('POST', $validate); if (is_array($validation_errors) && !empty($validation_errors)) { $data['status'] = 'error';
function delete_member($conn, $data) { $uuid = $data['id']; $type = $data['type']; // Type ossim_valid($uuid, OSS_HEX, 'illegal:' . _("ID")); ossim_valid($type, OSS_NULLABLE, OSS_LETTER, 'illegal:' . _("Device Type")); check_ossim_error(); if ($type == 'host') { Asset_host::delete_from_db($conn, $uuid); } elseif ($type == 'net') { Asset_net::delete_from_db($conn, $uuid); } else { throw new Exception(_('Invalid Action')); } $response['error'] = FALSE; $response['data'] = array(); return $response; }