<?php declare(strict_types = 0);
require_once dirname(__FILE__).'/../../include/forms.inc.php';
class CControllerPopupMassupdateHost extends CControllerPopupMassupdateAbstract {
protected function checkInput(): bool {
$fields = [
'hostids' => 'required|array',
'update' => 'in 1',
'visible' => 'array',
'tags' => 'array',
'macros' => 'array',
'groups' => 'array',
'host_inventory' => 'array',
'templates' => 'array',
'inventories' => 'array',
'description' => 'string',
'proxy_hostid' => 'string',
'ipmi_username' => 'string',
'ipmi_password' => 'string',
'tls_issuer' => 'string',
'tls_subject' => 'string',
'tls_psk_identity' => 'string',
'tls_psk' => 'string',
'valuemaps' => 'array',
'valuemap_remove' => 'array',
'valuemap_remove_except' => 'in 1',
'valuemap_remove_all' => 'in 1',
'valuemap_rename' => 'array',
'valuemap_update_existing' => 'in 1',
'valuemap_add_missing' => 'in 1',
'macros_add' => 'in 0,1',
'macros_update' => 'in 0,1',
'macros_remove' => 'in 0,1',
'macros_remove_all' => 'in 0,1',
'mass_clear_tpls' => 'in 0,1',
'mass_action_tpls' => 'in '.implode(',', [ZBX_ACTION_ADD, ZBX_ACTION_REPLACE, ZBX_ACTION_REMOVE]),
'mass_update_groups' => 'in '.implode(',', [ZBX_ACTION_ADD, ZBX_ACTION_REPLACE, ZBX_ACTION_REMOVE]),
'mass_update_tags' => 'in '.implode(',', [ZBX_ACTION_ADD, ZBX_ACTION_REPLACE, ZBX_ACTION_REMOVE]),
'mass_update_macros' => 'in '.implode(',', [ZBX_ACTION_ADD, ZBX_ACTION_REPLACE, ZBX_ACTION_REMOVE, ZBX_ACTION_REMOVE_ALL]),
'valuemap_massupdate' => 'in '.implode(',', [ZBX_ACTION_ADD, ZBX_ACTION_REPLACE, ZBX_ACTION_REMOVE, ZBX_ACTION_RENAME, ZBX_ACTION_REMOVE_ALL]),
'inventory_mode' => 'in '.implode(',', [HOST_INVENTORY_DISABLED, HOST_INVENTORY_MANUAL, HOST_INVENTORY_AUTOMATIC]),
'status' => 'in '.implode(',', [HOST_STATUS_MONITORED, HOST_STATUS_NOT_MONITORED]),
'tls_connect' => 'in '.implode(',', [HOST_ENCRYPTION_NONE, HOST_ENCRYPTION_PSK, HOST_ENCRYPTION_CERTIFICATE]),
'tls_accept' => 'ge 0|le '.(HOST_ENCRYPTION_NONE | HOST_ENCRYPTION_PSK | HOST_ENCRYPTION_CERTIFICATE),
'ipmi_authtype' => 'in '.implode(',', [IPMI_AUTHTYPE_DEFAULT, IPMI_AUTHTYPE_NONE, IPMI_AUTHTYPE_MD2, IPMI_AUTHTYPE_MD5, IPMI_AUTHTYPE_STRAIGHT, IPMI_AUTHTYPE_OEM, IPMI_AUTHTYPE_RMCP_PLUS]),
'ipmi_privilege' => 'in '.implode(',', [IPMI_PRIVILEGE_CALLBACK, IPMI_PRIVILEGE_USER, IPMI_PRIVILEGE_OPERATOR, IPMI_PRIVILEGE_ADMIN, IPMI_PRIVILEGE_OEM]),
'backurl' => 'string'
];
$ret = $this->validateInput($fields);
if (!$ret) {
$output = [];
if (($messages = getMessages()) !== null) {
$output['errors'] = $messages->toString();
}
$this->setResponse(
(new CControllerResponseData(['main_block' => json_encode($output)]))->disableView()
);
}
return $ret;
}
protected function checkPermissions(): bool {
$hosts = API::Host()->get([
'output' => [],
'hostids' => $this->getInput('hostids'),
'editable' => true