From 52ea0ba8fce5f288ee438cb27e606c26294b1be9 Mon Sep 17 00:00:00 2001 From: tsmr Date: Fri, 22 Sep 2017 14:27:21 +0200 Subject: [PATCH] Drop certificates from environment --- README.md | 2 -- environment.xml | 8 ++--- hook.php | 2 +- inc/display.class.php | 83 +++++++++---------------------------------- inc/profile.class.php | 7 ---- sql/empty-1.4.0.sql | 2 -- 6 files changed, 22 insertions(+), 82 deletions(-) diff --git a/README.md b/README.md index bd29a1b..263c9b0 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,6 @@ Ce plugin vous permet de regrouper 7 plugins dans un seul pour une meilleure vis > * Plugin "appliances":https://forge.glpi-project.org/projects/show/appliances > * Plugin "webapplications":https://github.com/InfotelGLPI/webapplications -> * Plugin "certificates":https://github.com/InfotelGLPI/certificates > * Plugin "accounts":https://github.com/InfotelGLPI/accounts > * Plugin "domains":https://github.com/InfotelGLPI/domains > * Plugin "databases":https://github.com/InfotelGLPI/databases @@ -23,7 +22,6 @@ This plugin enables you to group 7 plugins to one for more visibility of plugins > * "appliances":https://forge.glpi-project.org/projects/show/appliances Plugin > * "webapplications":https://github.com/InfotelGLPI/webapplications Plugin -> * "certificates":https://github.com/InfotelGLPI/certificates Plugin > * "accounts":https://github.com/InfotelGLPI/accounts Plugin > * "domains":https://github.com/InfotelGLPI/domains Plugin > * "databases":https://github.com/InfotelGLPI/databases Plugin diff --git a/environment.xml b/environment.xml index 2ca743d..03fffcd 100644 --- a/environment.xml +++ b/environment.xml @@ -6,12 +6,12 @@ https://raw.githubusercontent.com/InfotelGLPI/environment/master/environment.png - Peut contenir :
- Plugin appliances
- Plugin webapplications
- Plugin certificates
- Plugin accounts
- Plugin connections
- Plugin domains
- Plugin databases
- Plugin backups
- Plugin badges
- Plugin rights]]>
- Include
- Plugin appliances
- Plugin webapplications
- Plugin certificates
- Plugin accounts
- Plugin connections
- Plugin domains
- Plugin databases
- Plugin backups
- Plugin badges
- Plugin rights]]>
+ Peut contenir :
- Plugin appliances
- Plugin webapplications
- Plugin accounts
- Plugin connections
- Plugin domains
- Plugin databases
- Plugin backups
- Plugin badges
- Plugin rights]]>
+ Include
- Plugin appliances
- Plugin webapplications
- Plugin accounts
- Plugin connections
- Plugin domains
- Plugin databases
- Plugin backups
- Plugin badges
- Plugin rights]]>
- Peut contenir :
- Plugin appliances
- Plugin webapplications
- Plugin certificates
- Plugin accounts
- Plugin connections
- Plugin domains
- Plugin databases
- Plugin backups
- Plugin badges
- Plugin rights]]>
- Include
- Plugin appliances
- Plugin webapplications
- Plugin certificates
- Plugin accounts
- Plugin connections
- Plugin domains
- Plugin databases
- Plugin backups
- Plugin badges
- Plugin rights]]>
+ Peut contenir :
- Plugin appliances
- Plugin webapplications
- Plugin accounts
- Plugin connections
- Plugin domains
- Plugin databases
- Plugin backups
- Plugin badges
- Plugin rights]]>
+ Include
- Plugin appliances
- Plugin webapplications
- Plugin accounts
- Plugin connections
- Plugin domains
- Plugin databases
- Plugin backups
- Plugin badges
- Plugin rights]]>
https://github.com/InfotelGLPI/environment diff --git a/hook.php b/hook.php index 8ae165d..eaa50e5 100644 --- a/hook.php +++ b/hook.php @@ -74,7 +74,7 @@ function plugin_environment_install() { PluginEnvironmentProfile::initProfile(); PluginEnvironmentProfile::createFirstAccess($_SESSION['glpiactiveprofile']['id']); - $migration = new Migration("2..0"); + $migration = new Migration("2.0.0"); $migration->dropTable('glpi_plugin_environment_profiles'); $_SESSION["glpi_plugin_environment_installed"] = 1; diff --git a/inc/display.class.php b/inc/display.class.php index 59d2cd6..fd2ee44 100644 --- a/inc/display.class.php +++ b/inc/display.class.php @@ -38,7 +38,7 @@ class PluginEnvironmentDisplay extends CommonGLPI { static $rightname = "plugin_environment"; - static $plugins = array('appliances', 'webapplications', 'certificates', 'accounts', 'databases', 'domains', 'badges'); + static $plugins = array('appliances', 'webapplications', 'accounts', 'databases', 'domains', 'badges'); /** * @param int $nb @@ -67,8 +67,8 @@ static function getMenuContent() if ($plugin->isActivated($plug)) { if (Session::haveRight("plugin_" . $plug, READ)) { $table = "glpi_plugin_" . $plug . "_" . $plug; - - $itemtype = getItemTypeForTable($table); + $dbu = new DbUtils(); + $itemtype = $dbu->getItemTypeForTable($table); if (!class_exists($itemtype)) { continue; @@ -144,8 +144,8 @@ function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) $plugin = new Plugin(); if ($plugin->isActivated($plug)) { $table = "glpi_plugin_" . $plug . "_" . $plug; - - $itemtype = getItemTypeForTable($table); + $dbu = new DbUtils(); + $itemtype = $dbu->getItemTypeForTable($table); if (!class_exists($itemtype)) { continue; @@ -201,7 +201,7 @@ static function showappliances() echo ""; echo __('Appliances', 'environment'); echo ""; - + $dbu = new DbUtils(); $query = "SELECT COUNT(`glpi_plugin_appliances_appliances`.`id`) AS total, `glpi_plugin_appliances_appliancetypes`.`name` AS TYPE, `glpi_plugin_appliances_appliances`.`entities_id` @@ -209,7 +209,7 @@ static function showappliances() $query .= " LEFT JOIN `glpi_plugin_appliances_appliancetypes` ON (`glpi_plugin_appliances_appliances`.`plugin_appliances_appliancetypes_id` = `glpi_plugin_appliances_appliancetypes`.`id`) "; $query .= " LEFT JOIN `glpi_entities` ON (`glpi_entities`.`id` = `glpi_plugin_appliances_appliances`.`entities_id`) "; $query .= "WHERE `glpi_plugin_appliances_appliances`.`is_deleted` = '0' " - . getEntitiesRestrictRequest(" AND ", "glpi_plugin_appliances_appliances", '', '', true); + . $dbu->getEntitiesRestrictRequest(" AND ", "glpi_plugin_appliances_appliances", '', '', true); $query .= "GROUP BY `glpi_plugin_appliances_appliances`.`entities_id`,`TYPE` ORDER BY `glpi_entities`.`completename`, `glpi_plugin_appliances_appliancetypes`.`name`"; @@ -251,7 +251,7 @@ static function showwebapplications() echo ""; echo __('Web applications', 'environment'); echo ""; - + $dbu = new DbUtils(); $query = "SELECT COUNT(`glpi_plugin_webapplications_webapplications`.`id`) AS total, `glpi_plugin_webapplications_webapplicationtypes`.`name` AS TYPE, `glpi_plugin_webapplications_webapplications`.`entities_id` @@ -259,7 +259,7 @@ static function showwebapplications() $query .= " LEFT JOIN `glpi_plugin_webapplications_webapplicationtypes` ON (`glpi_plugin_webapplications_webapplications`.`plugin_webapplications_webapplicationtypes_id` = `glpi_plugin_webapplications_webapplicationtypes`.`id`) "; $query .= " LEFT JOIN `glpi_entities` ON (`glpi_entities`.`id`=`glpi_plugin_webapplications_webapplications`.`entities_id`) "; $query .= "WHERE `glpi_plugin_webapplications_webapplications`.`is_deleted` = '0' " - . getEntitiesRestrictRequest(" AND ", "glpi_plugin_webapplications_webapplications", '', '', true); + . $dbu->getEntitiesRestrictRequest(" AND ", "glpi_plugin_webapplications_webapplications", '', '', true); $query .= "GROUP BY `glpi_plugin_webapplications_webapplications`.`entities_id`,`TYPE` ORDER BY `glpi_entities`.`completename`, `glpi_plugin_webapplications_webapplicationtypes`.`name` "; $result = $DB->query($query); @@ -289,56 +289,6 @@ static function showwebapplications() } } - static function showcertificates() - { - global $CFG_GLPI, $DB; - - if (Session::haveRight("plugin_environment_certificates", READ)) { - echo ""; - echo ""; - echo ""; - - $query = "SELECT COUNT(`glpi_plugin_certificates_certificates`.`id`) AS total, - `glpi_plugin_certificates_certificatetypes`.`name` AS TYPE, - `glpi_plugin_certificates_certificates`.`entities_id` - FROM `glpi_plugin_certificates_certificates` "; - $query .= " LEFT JOIN `glpi_plugin_certificates_certificatetypes` ON (`glpi_plugin_certificates_certificates`.`plugin_certificates_certificatetypes_id` = `glpi_plugin_certificates_certificatetypes`.`id`) "; - $query .= " LEFT JOIN `glpi_entities` ON (`glpi_entities`.`id` = `glpi_plugin_certificates_certificates`.`entities_id`) "; - $query .= "WHERE `glpi_plugin_certificates_certificates`.`is_deleted` = '0' " - . getEntitiesRestrictRequest(" AND ", "glpi_plugin_certificates_certificates", '', '', true); - $query .= "GROUP BY `glpi_plugin_certificates_certificates`.`entities_id`,`TYPE` - ORDER BY `glpi_entities`.`completename`, `glpi_plugin_certificates_certificatetypes`.`name` "; - - $result = $DB->query($query); - if ($DB->numrows($result)) { - echo ""; - while ($data = $DB->fetch_array($result)) { - echo ""; - $link = ""; - if (Session::isMultiEntitiesMode()) { - echo ""; - if ($data["entities_id"] == 0) { - $link = "&criteria[1][link]=AND&criteria[1][searchtype]=contains&criteria[1][value]=-1&criteria[1][field]=81"; - } else { - $link = "&criteria[1][link]=AND&criteria[1][searchtype]=equals&criteria[1][value]=" . $data["entities_id"] . "&criteria[1][field]=80"; - } - } - if (empty($data["TYPE"])) - echo ""; - else - echo ""; - echo ""; - } - } else - echo ""; - - echo "
"; - echo ""; - echo __('Certificates', 'environment'); - echo "
" . __('Certificates', 'environment') . " :
" . Dropdown::getDropdownName("glpi_entities", $data["entities_id"]) . "" . $data["total"] . " " . __('Without type', 'environment') . "" . $data["total"] . " " . $data["TYPE"] . "
" . __('Certificates', 'environment') . " : 0

"; - } - } - static function showaccounts() { global $CFG_GLPI, $DB; @@ -383,8 +333,9 @@ static function showaccounts() $query .= " $ASSIGN "; } } + $dbu = new DbUtils(); $query .= " `glpi_plugin_accounts_accounts`.`is_deleted` = '0' " - . getEntitiesRestrictRequest(" AND ", "glpi_plugin_accounts_accounts", '', '', true); + . $dbu->getEntitiesRestrictRequest(" AND ", "glpi_plugin_accounts_accounts", '', '', true); $query .= "GROUP BY `glpi_plugin_accounts_accounts`.`entities_id`,`TYPE` ORDER BY `glpi_entities`.`completename`, `glpi_plugin_accounts_accounttypes`.`name`"; @@ -454,7 +405,7 @@ static function showdomains() echo "
"; echo __('Domains', 'environment'); echo ""; - + $dbu = new DbUtils(); $query = "SELECT COUNT(`glpi_plugin_domains_domains`.`id`) AS total, `glpi_plugin_domains_domaintypes`.`name` AS TYPE, `glpi_plugin_domains_domains`.`entities_id` @@ -462,7 +413,7 @@ static function showdomains() $query .= " LEFT JOIN `glpi_plugin_domains_domaintypes` ON (`glpi_plugin_domains_domains`.`plugin_domains_domaintypes_id` = `glpi_plugin_domains_domaintypes`.`id`) "; $query .= " LEFT JOIN `glpi_entities` ON (`glpi_entities`.`id` = `glpi_plugin_domains_domains`.`entities_id`) "; $query .= "WHERE `glpi_plugin_domains_domains`.`is_deleted` = '0' " - . getEntitiesRestrictRequest(" AND ", "glpi_plugin_domains_domains", '', '', true); + . $dbu->getEntitiesRestrictRequest(" AND ", "glpi_plugin_domains_domains", '', '', true); $query .= "GROUP BY `glpi_plugin_domains_domains`.`entities_id`,`TYPE` ORDER BY `glpi_entities`.`completename`, `glpi_plugin_domains_domaintypes`.`name` "; @@ -504,7 +455,7 @@ static function showdatabases() echo ""; echo __('Databases', 'environment'); echo ""; - + $dbu = new DbUtils(); $query = "SELECT COUNT(`glpi_plugin_databases_databases`.`id`) AS total, `glpi_plugin_databases_databasetypes`.`name` AS TYPE, `glpi_plugin_databases_databases`.`entities_id` @@ -512,7 +463,7 @@ static function showdatabases() $query .= " LEFT JOIN `glpi_plugin_databases_databasetypes` ON (`glpi_plugin_databases_databases`.`plugin_databases_databasetypes_id` = `glpi_plugin_databases_databasetypes`.`id`) "; $query .= " LEFT JOIN `glpi_entities` ON (`glpi_entities`.`id` = `glpi_plugin_databases_databases`.`entities_id`) "; $query .= "WHERE `glpi_plugin_databases_databases`.`is_deleted` = '0' " - . getEntitiesRestrictRequest(" AND ", "glpi_plugin_databases_databases", '', '', true); + . $dbu->getEntitiesRestrictRequest(" AND ", "glpi_plugin_databases_databases", '', '', true); $query .= "GROUP BY `glpi_plugin_databases_databases`.`entities_id`,`TYPE` ORDER BY `glpi_entities`.`completename`, `glpi_plugin_databases_databasetypes`.`name`"; @@ -546,7 +497,7 @@ static function showdatabases() static function showbadges() { global $CFG_GLPI, $DB; - + $dbu = new DbUtils(); if (Session::haveRight("plugin_environment_badges", READ)) { echo ""; echo ""; @@ -562,7 +513,7 @@ static function showbadges() $query .= " LEFT JOIN `glpi_plugin_badges_badgetypes` ON (`glpi_plugin_badges_badges`.`plugin_badges_badgetypes_id` = `glpi_plugin_badges_badgetypes`.`id`) "; $query .= " LEFT JOIN `glpi_entities` ON (`glpi_entities`.`id` = `glpi_plugin_badges_badges`.`entities_id`) "; $query .= "WHERE `glpi_plugin_badges_badges`.`is_deleted` = '0' " - . getEntitiesRestrictRequest(" AND ", "glpi_plugin_badges_badges", '', '', false); + . $dbu->getEntitiesRestrictRequest(" AND ", "glpi_plugin_badges_badges", '', '', false); $query .= "GROUP BY `glpi_plugin_badges_badges`.`entities_id`,`TYPE` ORDER BY `glpi_entities`.`completename`, `glpi_plugin_badges_badgetypes`.`name` "; diff --git a/inc/profile.class.php b/inc/profile.class.php index 56d4ef2..e58c151 100644 --- a/inc/profile.class.php +++ b/inc/profile.class.php @@ -71,7 +71,6 @@ static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtem array('plugin_environment' => 0, 'plugin_environment_appliances' => 0, 'plugin_environment_webapplications' => 0, - 'plugin_environment_certificates' => 0, 'plugin_environment_accounts' => 0, 'plugin_environment_domains' => 0, 'plugin_environment_databases' => 0, @@ -90,7 +89,6 @@ static function createFirstAccess($ID) { array('plugin_environment' => 1, 'plugin_environment_appliances' => 1, 'plugin_environment_webapplications' => 1, - 'plugin_environment_certificates' => 1, 'plugin_environment_accounts' => 1, 'plugin_environment_domains' => 1, 'plugin_environment_databases' => 1, @@ -185,10 +183,6 @@ static function getAllRights($all = false) { 'label' => __('Web applications', 'environment'), 'field' => 'plugin_environment_webapplications' ), - array('rights' => array(READ => __('Read')), - 'label' => __('Certificates', 'environment'), - 'field' => 'plugin_environment_certificates' - ), array('rights' => array(READ => __('Read')), 'label' => __('Accounts', 'environment'), 'field' => 'plugin_environment_accounts' @@ -256,7 +250,6 @@ static function migrateOneProfile($profiles_id) { $matching = array('environment' => 'plugin_environment', 'appliances' => 'plugin_environment_appliances', 'webapplications' => 'plugin_environment_webapplications', - 'certificates' => 'plugin_environment_certificates', 'accounts' => 'plugin_environment_accounts', 'domains' => 'plugin_environment_domains', 'databases' => 'plugin_environment_databases', diff --git a/sql/empty-1.4.0.sql b/sql/empty-1.4.0.sql index 7a688e8..d9d83a9 100644 --- a/sql/empty-1.4.0.sql +++ b/sql/empty-1.4.0.sql @@ -9,8 +9,6 @@ CREATE TABLE `glpi_plugin_environment_profiles` ( COLLATE utf8_unicode_ci DEFAULT NULL, `webapplications` CHAR(1) COLLATE utf8_unicode_ci DEFAULT NULL, - `certificates` CHAR(1) - COLLATE utf8_unicode_ci DEFAULT NULL, `accounts` CHAR(1) COLLATE utf8_unicode_ci DEFAULT NULL, `domains` CHAR(1)