From: Seamus Lee <seamuslee001@gmail.com>
Date: Fri, 14 Jul 2023 06:24:03 +0000 (+1000)
Subject: [REF] Ensure that getActions respects any modifications by event listerners modifying... 
X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2fbd28ad24419f2f3b192adb1265215064e0b422;p=civicrm-core.git

[REF] Ensure that getActions respects any modifications by event listerners modifying permissions
---

diff --git a/Civi/Api4/Action/GetActions.php b/Civi/Api4/Action/GetActions.php
index b88db07ca4..1705a10b26 100644
--- a/Civi/Api4/Action/GetActions.php
+++ b/Civi/Api4/Action/GetActions.php
@@ -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];