From 88d8cb3acc37889faec4574044d07b258784aea3 Mon Sep 17 00:00:00 2001 From: Herafia Date: Wed, 10 Jun 2026 10:23:38 +0200 Subject: [PATCH 1/3] fix uninstall delete right plugin --- inc/profile.class.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/inc/profile.class.php b/inc/profile.class.php index 6e0c6a7..848a17d 100644 --- a/inc/profile.class.php +++ b/inc/profile.class.php @@ -78,4 +78,12 @@ public function showForm($ID, $options = []) return true; } + + public static function uninstall(Migration $migration): void + { + /** @var DBmysql $DB */ + global $DB; + + $DB->delete('glpi_profilerights', ['name' => 'plugin_credit_ticketconfig']); + } } From 8d60b51d187ad17cb47aabc8f672f6f2f524341c Mon Sep 17 00:00:00 2001 From: Herafia Date: Wed, 10 Jun 2026 10:25:35 +0200 Subject: [PATCH 2/3] CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index eba3079..13043fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Fixed the minimum consumable quantity at 1 - Fixed `credit.css` returning 404 by moving it to the `public/` directory - Fix duplicate "low credits" alert generation in the cron job. +- Fix plugin uninstall to correctly remove plugin permissions ## [1.15.3] - 2026-04-29 From c321603c41509eeb4ecf49418efa691086dbffd9 Mon Sep 17 00:00:00 2001 From: Herafia Date: Wed, 10 Jun 2026 11:01:24 +0200 Subject: [PATCH 3/3] fix profile.class --- inc/profile.class.php | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/inc/profile.class.php b/inc/profile.class.php index 848a17d..d7952aa 100644 --- a/inc/profile.class.php +++ b/inc/profile.class.php @@ -60,12 +60,8 @@ public function showForm($ID, $options = []) $profile->getFromDB($ID); echo "
"; - $rights = [ - ['itemtype' => PluginCreditTicketConfig::getType(), - 'label' => PluginCreditTicketConfig::getTypeName(Session::getPluralNumber()), - 'field' => PluginCreditTicketConfig::$rightname, - ], - ]; + $rights = self::getAllRights(); + $matrix_options['title'] = PluginCreditTicketConfig::getTypeName(Session::getPluralNumber()); $profile->displayRightsChoiceMatrix($rights, $matrix_options); @@ -79,11 +75,20 @@ public function showForm($ID, $options = []) return true; } - public static function uninstall(Migration $migration): void + private static function getAllRights() { - /** @var DBmysql $DB */ - global $DB; + return [ + ['itemtype' => PluginCreditTicketConfig::getType(), + 'label' => PluginCreditTicketConfig::getTypeName(Session::getPluralNumber()), + 'field' => PluginCreditTicketConfig::$rightname, + ], + ]; + } - $DB->delete('glpi_profilerights', ['name' => 'plugin_credit_ticketconfig']); + public static function uninstall(Migration $migration): void + { + foreach (self::getAllRights() as $right) { + ProfileRight::deleteProfileRights([$right['field']]); + } } }