? permissions_uninstall.patch ? sites/default/files ? sites/default/modules ? sites/default/themes Index: includes/install.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/install.inc,v retrieving revision 1.67 diff -u -p -r1.67 install.inc --- includes/install.inc 28 Aug 2008 08:40:33 -0000 1.67 +++ includes/install.inc 9 Sep 2008 18:34:09 -0000 @@ -565,6 +565,7 @@ function drupal_uninstall_module($module // Uninstall the module(s). module_load_install($module); module_invoke($module, 'uninstall'); + module_permission_uninstall($module); // Now remove the menu links for all paths declared by this module. if (!empty($paths)) { Index: includes/module.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/module.inc,v retrieving revision 1.124 diff -u -p -r1.124 module.inc --- includes/module.inc 21 Aug 2008 19:36:36 -0000 1.124 +++ includes/module.inc 9 Sep 2008 18:34:10 -0000 @@ -338,6 +338,22 @@ function module_disable($module_list) { } /** + * Removes permissions set by a module. This routine is automatically called during + * the module uninstall process. It may also be called directly. + * + * @param $module + * The name of the module for which permissions should be removed. + */ +function module_permission_uninstall($module) { + // Get the module permissions. + $module_perms = module_invoke($module, 'perm'); + if (!empty($module_perms)) { + $query = db_delete('role_permission')->condition('permission', array_keys($module_perms), 'IN'); + $query->execute(); + } +} + +/** * @defgroup hooks Hooks * @{ * Allow modules to interact with the Drupal core.