diff --git a/lib/Command/UserExport.php b/lib/Command/UserExport.php index 6c6d05dbc..771d91346 100644 --- a/lib/Command/UserExport.php +++ b/lib/Command/UserExport.php @@ -88,13 +88,8 @@ class UserExport extends Command { $userId = $input->getArgument('user-id'); - $groups = $this->groupManager->getUserGroupIds( - $this->userManager->get($userId) - ); - $boards = $this->boardService->findAll([ - 'user' => $userId, - 'groups' => $groups - ]); + $this->boardService->setUserId($userId); + $boards = $this->boardService->findAll(); $data = []; foreach ($boards as $board) { diff --git a/lib/Service/BoardService.php b/lib/Service/BoardService.php index 1e03b7445..838e4f6d8 100644 --- a/lib/Service/BoardService.php +++ b/lib/Service/BoardService.php @@ -98,6 +98,15 @@ class BoardService { $this->userId = $userId; } + /** + * Set a different user than the current one, e.g. when no user is available in occ + * + * @param string $userId + */ + public function setUserId(string $userId): void { + $this->userId = $userId; + } + /** * @return array */ diff --git a/tests/unit/Command/UserExportTest.php b/tests/unit/Command/UserExportTest.php index 349f0b331..16e455cfc 100644 --- a/tests/unit/Command/UserExportTest.php +++ b/tests/unit/Command/UserExportTest.php @@ -89,28 +89,12 @@ class UserExportTest extends \Test\TestCase { $input->expects($this->once())->method('getArgument')->with('user-id')->willReturn('admin'); $output = $this->createMock(OutputInterface::class); - $user = $this->createMock(IUser::class); - $this->userManager->expects($this->once()) - ->method('get') - ->with('admin') - ->willReturn($user); - - $groups = []; - $this->groupManager->expects($this->once()) - ->method('getUserGroupIds') - ->with($user) - ->willReturn($groups); - $boards = [ $this->getBoard(1), $this->getBoard(2), ]; $this->boardService->expects($this->once()) ->method('findAll') - ->with([ - 'user' => 'admin', - 'groups' => $groups - ]) ->willReturn($boards); $this->boardMapper->expects($this->exactly(count($boards))) ->method('find')