Skip to content

Commit

Permalink
Standalone - Refresh 'Administer Role Permissions' search display whe…
Browse files Browse the repository at this point in the history
…n modifying roles
  • Loading branch information
colemanw committed Sep 24, 2024
1 parent bfbfcae commit 7cd807c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ext/standaloneusers/CRM/Standaloneusers/BAO/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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();
}
}

/**
Expand Down

0 comments on commit 7cd807c

Please sign in to comment.