foreach ($module_files as $module_file) {
// Clean up old module permissions that have been removed in the current
// module version.
- $this->userPermissionClass->upgradePermissions($module_file['prefix']);
+ $this->userPermissionClass->upgradePermissions(
+ $module_file['prefix'],
+ $this->userPermissionClass->getModulePermissions($module_file['prefix'])
+ );
}
}
* actually defined by that module. This is useful during module upgrade
* when the newer module version has removed permission that were defined
* in the older version.
+ *
+ * @param string $module short-name
+ * @param array $modulePermissions same format as CRM_Core_Permission::getCorePermissions().
+ * @see CRM_Core_Permission::getCorePermissions
*/
- function upgradePermissions($module) {
+ function upgradePermissions($module, $modulePermissions) {
}
/**
}
/**
- * Ensure that all cached permissions associated with the given module are
- * actually defined by that module. This is useful during module upgrade
- * when the newer module version has removed permission that were defined
- * in the older version.
+ * {@inheritdoc}
*/
- function upgradePermissions($module) {
+ function upgradePermissions($module, $modulePermissions) {
$config = CRM_Core_Config::singleton();
// Get all permissions defined by the module.
- $module_permissions = self::filterPermissions($config->userPermissionClass->getModulePermissions($module), $module);
+ $module_permissions = self::filterPermissions($modulePermissions, $module);
// Construct a delete query to remove permissions for this module.
$query = db_delete('role_permission')
->condition('permission', "$module|%", 'LIKE')
}
/**
- * Ensure that all cached permissions associated with the given module are
- * actually defined by that module. This is useful during module upgrade
- * when the newer module version has removed permission that were defined
- * in the older version.
+ * {@inheritdoc}
*
* Does nothing in Drupal 6.
*/
- function upgradePermissions($module) {
+ function upgradePermissions($module, $modulePermissions) {
}
/**