From 7cd807ce3532b054c174eeed0cbd638ead2f3092 Mon Sep 17 00:00:00 2001 From: colemanw Date: Tue, 24 Sep 2024 19:03:44 -0400 Subject: [PATCH] Standalone - Refresh 'Administer Role Permissions' search display when modifying roles --- ext/standaloneusers/CRM/Standaloneusers/BAO/Role.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ext/standaloneusers/CRM/Standaloneusers/BAO/Role.php b/ext/standaloneusers/CRM/Standaloneusers/BAO/Role.php index a7fb11cb09c8..c47af400ba1d 100644 --- a/ext/standaloneusers/CRM/Standaloneusers/BAO/Role.php +++ b/ext/standaloneusers/CRM/Standaloneusers/BAO/Role.php @@ -5,6 +5,7 @@ */ use Civi\Api4\Event\AuthorizeRecordEvent; +use CRM_Standaloneusers_ExtensionUtil as E; class CRM_Standaloneusers_BAO_Role extends CRM_Standaloneusers_DAO_Role implements \Civi\Core\HookInterface { @@ -15,6 +16,14 @@ class CRM_Standaloneusers_BAO_Role extends CRM_Standaloneusers_DAO_Role implemen public static function self_hook_civicrm_post(\Civi\Core\Event\PostEvent $event) { // Reset cache Civi::cache('metadata')->clear(); + // Rebuild role-based search displays if they will be affected by this action + if ($event->action === 'delete' || $event->action === 'create' || + ($event->action === 'edit' && (isset($event->params['label']) || isset($event->params['is_active']))) + ) { + \Civi\Api4\Managed::reconcile(FALSE) + ->addModule(E::LONG_NAME) + ->execute(); + } } /**