diff --git a/src/Util/BootTrait.php b/src/Util/BootTrait.php index 49e3b47c..8f056bb7 100644 --- a/src/Util/BootTrait.php +++ b/src/Util/BootTrait.php @@ -42,6 +42,15 @@ public function boot(InputInterface $input, OutputInterface $output) { throw new \Exception("Unrecognized bootstrap level"); } + if (!$input->getOption('user') && is_callable(['Civi', 'dispatcher'])) { + // The CLI user has superpowers. + \Civi::dispatcher()->addListener('hook_civicrm_permission_check', function($e) { + if ($e->contactId === NULL) { + $e->granted = TRUE; + } + }); + } + $output->writeln('[BootTrait] Finished', OutputInterface::VERBOSITY_DEBUG); }