Added enable console task feature
This commit is contained in:
parent
79162a787b
commit
cc776ddbf7
|
@ -133,6 +133,11 @@ class DiscoveryTaskList extends HTML
|
|||
return $this->deleteConsoleTask();
|
||||
}
|
||||
|
||||
$toggle_console_task = (int) get_parameter('toggle_console_task', -1);
|
||||
if ($toggle_console_task === 1 || $toggle_console_task === 0) {
|
||||
return $this->toggleConsoleTask($toggle_console_task);
|
||||
}
|
||||
|
||||
$delete = (bool) get_parameter('delete', false);
|
||||
if ($delete === true) {
|
||||
return $this->deleteTask();
|
||||
|
@ -321,6 +326,49 @@ class DiscoveryTaskList extends HTML
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Toggle enable/disable status of selected Console Task.
|
||||
*
|
||||
* @param integer $enable If 1 enable the console task.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function toggleConsoleTask(int $enable)
|
||||
{
|
||||
global $config;
|
||||
|
||||
if ((bool) check_acl($config['id_user'], 0, 'RM') === false) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access recon task viewer'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
$id_console_task = (int) get_parameter('id_console_task');
|
||||
|
||||
if ($id_console_task > 0) {
|
||||
$result = db_process_sql_update(
|
||||
'tuser_task_scheduled',
|
||||
['enabled' => $enable],
|
||||
['id' => $id_console_task]
|
||||
);
|
||||
|
||||
if ((int) $result === 1) {
|
||||
return [
|
||||
'result' => 0,
|
||||
'msg' => ((bool) $enable === true) ? __('Task successfully enabled') : __('Task succesfully disabled'),
|
||||
'id' => false,
|
||||
];
|
||||
}
|
||||
|
||||
// Trick to avoid double execution.
|
||||
header('Location: '.$this->url);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete a Console task.
|
||||
*
|
||||
|
|
|
@ -3845,6 +3845,7 @@ CREATE TABLE IF NOT EXISTS `tuser_task_scheduled` (
|
|||
`custom_data` INT NULL DEFAULT 0,
|
||||
`flag_delete` TINYINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`id_grupo` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`enabled` TINYINT UNSIGNED NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
||||
|
|
Loading…
Reference in New Issue