Implement share provider for deck
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -113,13 +113,13 @@ class BoardService {
|
||||
$this->userId = $userId;
|
||||
}
|
||||
|
||||
public function getUserBoards(int $since = -1, $includeArchived = true): array {
|
||||
$userInfo = $this->getBoardPrerequisites();
|
||||
$userBoards = $this->boardMapper->findAllByUser($userInfo['user'], null, null, $since, $includeArchived);
|
||||
$groupBoards = $this->boardMapper->findAllByGroups($userInfo['user'], $userInfo['groups'],null, null, $since, $includeArchived);
|
||||
$circleBoards = $this->boardMapper->findAllByCircles($userInfo['user'], null, null, $since, $includeArchived);
|
||||
return array_unique(array_merge($userBoards, $groupBoards, $circleBoards));
|
||||
/**
|
||||
* Get all boards that are shared with a user, their groups or circles
|
||||
*/
|
||||
public function getUserBoards(int $since = -1, bool $includeArchived = true): array {
|
||||
return $this->boardMapper->findAllForUser($this->userId, $since, $includeArchived);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace OCA\Deck\Service;
|
||||
use OCA\Deck\Activity\ActivityManager;
|
||||
use OCA\Deck\Activity\ChangeSet;
|
||||
use OCA\Deck\Db\AssignmentMapper;
|
||||
use OCA\Deck\Db\Board;
|
||||
use OCA\Deck\Db\Card;
|
||||
use OCA\Deck\Db\CardMapper;
|
||||
use OCA\Deck\Db\Acl;
|
||||
@@ -116,12 +117,23 @@ class CardService {
|
||||
return $cards;
|
||||
}
|
||||
|
||||
public function search($boardIds, $term) {
|
||||
$cards = $this->cardMapper->search($boardIds, $term);
|
||||
return $cards;
|
||||
public function search(string $term, int $limit = null, int $offset = null): array {
|
||||
$boards = $this->boardService->getUserBoards();
|
||||
$boardIds = array_map(static function (Board $board) {
|
||||
return $board->getId();
|
||||
}, $boards);
|
||||
return $this->cardMapper->search($boardIds, $term, $limit, $offset);
|
||||
}
|
||||
|
||||
/**
|
||||
public function searchRaw(string $term, int $limit = null, int $offset = null): array {
|
||||
$boards = $this->boardService->getUserBoards();
|
||||
$boardIds = array_map(static function (Board $board) {
|
||||
return $board->getId();
|
||||
}, $boards);
|
||||
return $this->cardMapper->searchRaw($boardIds, $term, $limit, $offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $cardId
|
||||
* @return \OCA\Deck\Db\RelationalEntity
|
||||
* @throws \OCA\Deck\NoPermissionException
|
||||
|
||||
Reference in New Issue
Block a user