try {
if (!isset($this->_actions[$actionName]) && (!$this->_actionsToGet || in_array($actionName, $this->_actionsToGet))) {
$action = \Civi\API\Request::create($this->getEntityName(), $actionName, ['version' => 4]);
- $authorized = \Civi::service('civi_api_kernel')->runAuthorize($this->getEntityName(), $actionName, ['version' => 4]);
- if (is_object($action) && (!$this->checkPermissions || $authorized)) {
+ $authorized = !$this->checkPermissions || \Civi::service('civi_api_kernel')->runAuthorize($this->getEntityName(), $actionName, ['version' => 4]);
+ if (is_object($action) && $authorized) {
$this->_actions[$actionName] = ['name' => $actionName];
if ($this->_isFieldSelected('description', 'comment', 'see')) {
$vars = ['entity' => $this->getEntityName(), 'action' => $actionName];
}
}
- public function testContactIconAutocomplete(): void {
+ public function testActionPermissionsOverride(): void {
$contact = $this->createTestRecord('Contact', [
'first_name' => 'GetActions',
'last_name' => 'testContact',