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 diff --git a/inc/profile.class.php b/inc/profile.class.php index 6e0c6a7..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); @@ -78,4 +74,21 @@ public function showForm($ID, $options = []) return true; } + + private static function getAllRights() + { + return [ + ['itemtype' => PluginCreditTicketConfig::getType(), + 'label' => PluginCreditTicketConfig::getTypeName(Session::getPluralNumber()), + 'field' => PluginCreditTicketConfig::$rightname, + ], + ]; + } + + public static function uninstall(Migration $migration): void + { + foreach (self::getAllRights() as $right) { + ProfileRight::deleteProfileRights([$right['field']]); + } + } }