mirror of
https://github.com/tips-of-mine/GLPI-Plugin-SOC-Case-Management.git
synced 2025-06-27 21:28:42 +02:00
Ajouter le fichier hook.php et corriger l'installation
This commit is contained in:
15
README.md
15
README.md
@ -21,9 +21,18 @@ This plugin provides a specialized case management system for Security Operation
|
||||
## Installation
|
||||
1. Download the ZIP file
|
||||
2. Extract it in your GLPI plugins directory (`glpi/plugins/`)
|
||||
3. Rename the directory to "soc" if needed
|
||||
4. Navigate to Setup > Plugins in your GLPI web interface
|
||||
5. Install and activate the plugin
|
||||
3. Rename the directory to "soc" (this is important - the folder must be named "soc")
|
||||
4. Make sure all files have correct permissions (www-data or apache user should be able to read them)
|
||||
5. Navigate to Setup > Plugins in your GLPI web interface
|
||||
6. Install and activate the plugin
|
||||
|
||||
## Troubleshooting Installation
|
||||
If the plugin doesn't appear in the plugins list:
|
||||
- Verify the plugin folder is named exactly "soc" (not "SOC" or "soc-plugin")
|
||||
- Check file permissions (files should be readable by the web server)
|
||||
- Check that all required files are present: setup.php, hook.php, plugin.php
|
||||
- Clear GLPI cache by removing files in `/glpi/files/_cache`
|
||||
- Restart your web server
|
||||
|
||||
## Configuration
|
||||
After activation, you can configure the plugin by:
|
||||
|
74
hook.php
Normal file
74
hook.php
Normal file
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/**
|
||||
* Hook functions for the SOC plugin
|
||||
*/
|
||||
|
||||
/**
|
||||
* Hook called after a new item has been added
|
||||
*
|
||||
* @param CommonDBTM $item
|
||||
* @return void
|
||||
*/
|
||||
function plugin_soc_item_add(CommonDBTM $item) {
|
||||
// Add actions when a new item is created
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook called after an item has been updated
|
||||
*
|
||||
* @param CommonDBTM $item
|
||||
* @return void
|
||||
*/
|
||||
function plugin_soc_item_update(CommonDBTM $item) {
|
||||
// Add actions when an item is updated
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook called after an item has been deleted
|
||||
*
|
||||
* @param CommonDBTM $item
|
||||
* @return void
|
||||
*/
|
||||
function plugin_soc_item_delete(CommonDBTM $item) {
|
||||
// Add actions when an item is deleted
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook called after an item has been purged
|
||||
*
|
||||
* @param CommonDBTM $item
|
||||
* @return void
|
||||
*/
|
||||
function plugin_soc_item_purge(CommonDBTM $item) {
|
||||
// Add actions when an item is purged
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook called when displaying the tabs for an item
|
||||
*
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
function plugin_soc_getAddSearchOptions($itemtype) {
|
||||
$options = [];
|
||||
|
||||
// Add search options for supported item types
|
||||
if ($itemtype == 'Ticket' || $itemtype == 'Change') {
|
||||
$options[9000] = [
|
||||
'table' => 'glpi_plugin_soc_cases',
|
||||
'field' => 'name',
|
||||
'name' => __('SOC Case', 'soc'),
|
||||
'joinparams' => [
|
||||
'beforejoin' => [
|
||||
'table' => $itemtype == 'Ticket' ? 'glpi_plugin_soc_case_tickets' : 'glpi_plugin_soc_case_changes',
|
||||
'joinparams' => [
|
||||
'jointype' => 'itemtype_item',
|
||||
'specific_itemtype' => $itemtype
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
68
setup.php
68
setup.php
@ -97,4 +97,72 @@ function plugin_soc_uninstall() {
|
||||
$DB->query($query) or die("Error deleting plugin_soc display preferences");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Define hooks
|
||||
*/
|
||||
function plugin_init_soc() {
|
||||
global $PLUGIN_HOOKS;
|
||||
|
||||
// Add plugin hooks here
|
||||
}
|
||||
|
||||
/**
|
||||
* Define database relations
|
||||
*/
|
||||
function plugin_soc_getDatabaseRelations() {
|
||||
return [
|
||||
'glpi_entities' => [
|
||||
'glpi_plugin_soc_cases' => 'entities_id'
|
||||
],
|
||||
'glpi_users' => [
|
||||
'glpi_plugin_soc_cases' => 'users_id_tech'
|
||||
],
|
||||
'glpi_groups' => [
|
||||
'glpi_plugin_soc_cases' => 'groups_id_tech'
|
||||
],
|
||||
'glpi_tickets' => [
|
||||
'glpi_plugin_soc_case_tickets' => 'tickets_id'
|
||||
],
|
||||
'glpi_changes' => [
|
||||
'glpi_plugin_soc_case_changes' => 'changes_id'
|
||||
],
|
||||
'glpi_plugin_soc_cases' => [
|
||||
'glpi_plugin_soc_case_tickets' => 'plugin_soc_cases_id',
|
||||
'glpi_plugin_soc_case_changes' => 'plugin_soc_cases_id'
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Define display preferences
|
||||
*/
|
||||
function plugin_soc_getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
|
||||
$tabs = [];
|
||||
|
||||
if ($item->getType() == 'Ticket' && Session::haveRight("plugin_soc_case", READ)) {
|
||||
$tabs[1] = __('SOC Cases', 'soc');
|
||||
}
|
||||
|
||||
if ($item->getType() == 'Change' && Session::haveRight("plugin_soc_case", READ)) {
|
||||
$tabs[1] = __('SOC Cases', 'soc');
|
||||
}
|
||||
|
||||
return $tabs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Define right names
|
||||
*/
|
||||
function plugin_soc_getRights($itemtype = '') {
|
||||
$rights = [
|
||||
[
|
||||
'itemtype' => 'PluginSocCase',
|
||||
'label' => __('SOC Case', 'soc'),
|
||||
'field' => 'plugin_soc_case'
|
||||
]
|
||||
];
|
||||
|
||||
return $rights;
|
||||
}
|
Reference in New Issue
Block a user