Issue #3323380 by amateescu, smustgrave: Allow switching to any workspace in CLI requests

(cherry picked from commit 40c86d902c)
merge-requests/3618/head
catch 2023-03-07 15:56:22 +00:00
parent 94be34d2be
commit 98a79c1bfd
1 changed files with 2 additions and 2 deletions

View File

@ -240,8 +240,8 @@ class WorkspaceManager implements WorkspaceManagerInterface {
*/
protected function doSwitchWorkspace($workspace) {
// If the current user doesn't have access to view the workspace, they
// shouldn't be allowed to switch to it.
if ($workspace && !$workspace->access('view')) {
// shouldn't be allowed to switch to it, except in CLI processes.
if ($workspace && PHP_SAPI !== 'cli' && !$workspace->access('view')) {
$this->logger->error('Denied access to view workspace %workspace_label for user %uid', [
'%workspace_label' => $workspace->label(),
'%uid' => $this->currentUser->id(),