Correction pour rendre le plugin visible dans GLPI

This commit is contained in:
tips-of-mine
2025-05-31 11:23:24 +02:00
committed by GitHub
parent 3b1d93e916
commit 5aa9cfb33e
4 changed files with 183 additions and 0 deletions

22
front/config.form.php Normal file
View File

@ -0,0 +1,22 @@
<?php
include ("../../../inc/includes.php");
Session::checkRight("config", UPDATE);
// Check if plugin is activated
if (!Plugin::isPluginActive("soc")) {
Html::displayNotFoundError();
}
Html::header(__('SOC Case Management Configuration', 'soc'), '', "config", "plugins");
$config = new PluginSocConfig();
if (isset($_POST["update"])) {
Session::checkRight("config", UPDATE);
$config->update($_POST);
Html::back();
} else {
$config->showConfigForm();
}
Html::footer();

1
icon.png Normal file

File diff suppressed because one or more lines are too long

98
inc/config.class.php Normal file
View File

@ -0,0 +1,98 @@
<?php
/**
* SOC Config Class
*/
class PluginSocConfig extends CommonDBTM {
static $rightname = 'config';
/**
* Show config form
*
* @return void
*/
function showConfigForm() {
global $CFG_GLPI;
$config = self::getConfig();
echo "<form name='form' action='".Toolbox::getItemTypeFormURL(__CLASS__)."' method='post'>";
echo "<div class='center' id='tabsbody'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'>";
echo "<th colspan='4'>".__('SOC Case Management Configuration', 'soc')."</th>";
echo "</tr>";
echo "<tr class='tab_bg_2'>";
echo "<td>".__('Auto-close cases after (days)', 'soc')."</td>";
echo "<td>";
Dropdown::showNumber('autoclose_delay', ['value' => $config['autoclose_delay'],
'min' => 0,
'max' => 999,
'toadd' => [0 => __('Never')]]);
echo "</td>";
echo "<td>".__('Default severity for new cases', 'soc')."</td>";
echo "<td>";
Dropdown::showFromArray('default_severity', PluginSocCase::getSeverityOptions(),
['value' => $config['default_severity']]);
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_2'>";
echo "<td colspan='4' class='center'>";
echo "<input type='submit' name='update' value=\""._sx('button', 'Save')."\" class='submit'>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</div>";
Html::closeForm();
}
/**
* Get plugin config
*
* @return array
*/
static function getConfig() {
$config = Config::getConfigurationValues('plugin:soc');
$default_config = [
'autoclose_delay' => 0,
'default_severity' => PluginSocCase::SEVERITY_MEDIUM
];
// Set default values if not set
foreach ($default_config as $key => $value) {
if (!isset($config[$key])) {
$config[$key] = $value;
}
}
return $config;
}
/**
* Hook to install initial configuration
*/
static function install() {
$default_config = [
'autoclose_delay' => 0,
'default_severity' => PluginSocCase::SEVERITY_MEDIUM
];
Config::setConfigurationValues('plugin:soc', $default_config);
return true;
}
/**
* Hook to uninstall configuration
*/
static function uninstall() {
Config::deleteConfigurationValues('plugin:soc', ['autoclose_delay', 'default_severity']);
return true;
}
}

62
plugin.xml Normal file
View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<root>
<name>SOC Case Management</name>
<key>soc</key>
<state>beta</state>
<logo>https://raw.githubusercontent.com/tips-of-mine/GLPI-Plugin-SOC-Case-Management/master/docs/images/logo.png</logo>
<description>
<short>
<de>SOC-Case-Management GLPI-Plugin.</de>
<en>SOC Case Management GLPI plugin.</en>
<fr>Plugin GLPI SOC Case Management.</fr>
<it>Plug-in GLPI "SOC Case Management".</it>
<pl>Plugin SOC Case Management.</pl>
<es>Plugin GLPI de SOC Case Management.</es>
<pt>Plugin GLPI de SOC Case Management.</pt>
</short>
<long>
<de>SOC-Case-Management-Integrations-GLPI-Plugin für Sicherheitsteams.</de>
<en>SOC Case Management integration plugin for security teams.</en>
<fr>Plugin d'intégration de gestion de cas SOC pour les équipes de sécurité.</fr>
<it>Plugin di integrazione per la gestione dei casi SOC per team di sicurezza.</it>
<pl>Wtyczka integracji zarządzania przypadkami SOC dla zespołów bezpieczeństwa.</pl>
<es>Plugin de integración de gestión de casos SOC para equipos de seguridad.</es>
<pt>Plugin de integração de gestão de casos SOC para equipas de segurança.</pt>
</long>
</description>
<homepage>https://github.com/tips-of-mine/GLPI-Plugin-SOC-Case-Management/</homepage>
<download>https://github.com/tips-of-mine/GLPI-Plugin-SOC-Case-Management/releases</download>
<issues>https://github.com/tips-of-mine/GLPI-Plugin-SOC-Case-Management/issues</issues>
<readme>https://github.com/tips-of-mine/GLPI-Plugin-SOC-Case-Management/blob/master/README.md</readme>
<authors>
<author>Tips-Of-Mine</author>
</authors>
<versions>
<version>
<num>1.0.0</num>
<compatibility>~10.0</compatibility>
</version>
</versions>
<langs>
<lang>de_DE</lang>
<lang>en_GB</lang>
<lang>fr_FR</lang>
<lang>it_IT</lang>
<lang>pl_PL</lang>
<lang>es_ES</lang>
<lang>pt_PT</lang>
</langs>
<license>GPL V3+</license>
<tags>
<en>
<tag>Security</tag>
<tag>SOC</tag>
<tag>Case Management</tag>
</en>
<fr>
<tag>Sécurité</tag>
<tag>SOC</tag>
<tag>Gestion de cas</tag>
</fr>
</tags>
</root>