[REF] Ensure that getActions respects any modifications by event listerners modifying...
authorSeamus Lee <seamuslee001@gmail.com>
Fri, 14 Jul 2023 06:24:03 +0000 (16:24 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Fri, 14 Jul 2023 06:24:03 +0000 (16:24 +1000)
Civi/Api4/Action/GetActions.php

index b88db07ca40ecc1537740fb005c8fb661a1a9db3..1705a10b26925dc96df5d0721d9f882c80c5afeb 100644 (file)
@@ -79,7 +79,8 @@ class GetActions extends BasicGetAction {
     try {
       if (!isset($this->_actions[$actionName]) && (!$this->_actionsToGet || in_array($actionName, $this->_actionsToGet))) {
         $action = \Civi\API\Request::create($this->getEntityName(), $actionName, ['version' => 4]);
-        if (is_object($action) && (!$this->checkPermissions || $action->isAuthorized(\CRM_Core_Session::singleton()->getLoggedInContactID()))) {
+        $authorized = \Civi::service('civi_api_kernel')->runAuthorize($this->getEntityName(), $actionName, ['version' => 4]);
+        if (is_object($action) && (!$this->checkPermissions || $authorized)) {
           $this->_actions[$actionName] = ['name' => $actionName];
           if ($this->_isFieldSelected('description', 'comment', 'see')) {
             $vars = ['entity' => $this->getEntityName(), 'action' => $actionName];