diff --git a/lib/Controller/BoardApiController.php b/lib/Controller/BoardApiController.php index 088a62d73..5222068d7 100644 --- a/lib/Controller/BoardApiController.php +++ b/lib/Controller/BoardApiController.php @@ -55,6 +55,7 @@ class BoardApiController extends ApiController { $this->userId = $userId; $this->userManager = $userManager; $this->groupManager = $groupManager; + $this->userInfo = $this->service->getBoardPrerequisites(); } /** @@ -65,7 +66,7 @@ class BoardApiController extends ApiController { * Return all of the boards that the current user has access to. */ public function index() { - $boards = $this->service->findAll($this->getUserInfo()); + $boards = $this->service->findAll($this->userInfo); return new DataResponse($boards); } @@ -132,13 +133,4 @@ class BoardApiController extends ApiController { return new DataResponse($board); } - // this is taken from BoardController, but it's not ideal - private function getUserInfo() { - $groups = $this->groupManager->getUserGroupIds( - $this->userManager->get($this->userId) - ); - return ['user' => $this->userId, - 'groups' => $groups]; - } - } diff --git a/lib/Controller/BoardController.php b/lib/Controller/BoardController.php index 0ecd044b1..d447f849e 100644 --- a/lib/Controller/BoardController.php +++ b/lib/Controller/BoardController.php @@ -47,21 +47,7 @@ class BoardController extends ApiController { $this->groupManager = $groupManager; $this->boardService = $boardService; $this->permissionService = $permissionService; - $this->userInfo = $this->getBoardPrerequisites(); - } - - /** - * TODO: move to boardservice - * @return array - */ - private function getBoardPrerequisites() { - $groups = $this->groupManager->getUserGroupIds( - $this->userManager->get($this->userId) - ); - return [ - 'user' => $this->userId, - 'groups' => $groups - ]; + $this->userInfo = $this->boardSerivce->getBoardPrerequisites(); } /** diff --git a/lib/Service/BoardService.php b/lib/Service/BoardService.php index ab6baf225..e9140d09a 100644 --- a/lib/Service/BoardService.php +++ b/lib/Service/BoardService.php @@ -112,6 +112,16 @@ class BoardService { return $board; } + public function getBoardPrerequisites() { + $groups = $this->groupManager->getUserGroupIds( + $this->userManager->get($this->userId) + ); + return [ + 'user' => $this->userId, + 'groups' => $groups + ]; + } + public function isArchived($mapper, $id) { try { $boardId = $id;