Allow to use card item without being available in global card store
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -167,20 +167,4 @@ class CardController extends Controller {
|
||||
public function unassignUser($cardId, $userId, $type = 0) {
|
||||
return $this->assignmentService->unassignUser($cardId, $userId, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @return array
|
||||
*/
|
||||
public function findAllWithDue($userId) {
|
||||
return $this->dashboardService->findAllWithDue($userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @return array
|
||||
*/
|
||||
public function findMyAssignedCards($userId) {
|
||||
return $this->dashboardService->findMyAssignedCards($userId);
|
||||
}
|
||||
}
|
||||
|
||||
56
lib/Controller/DashboardApiController.php
Normal file
56
lib/Controller/DashboardApiController.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2020 Jakob Röhrl <jakob.roehrl@web.de>
|
||||
*
|
||||
* @author Jakob Röhrl <jakob.roehrl@web.de>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\Deck\Controller;
|
||||
|
||||
|
||||
use OCA\Deck\Service\DashboardService;
|
||||
use OCP\IRequest;
|
||||
use OCP\AppFramework\Controller;
|
||||
|
||||
class DashboardApiController extends OCSController {
|
||||
private $userId;
|
||||
private $cardService;
|
||||
|
||||
public function __construct($appName, IRequest $request, DashboardService $dashboardService, $userId) {
|
||||
parent::__construct($appName, $request);
|
||||
$this->userId = $userId;
|
||||
$this->dashboardService = $dashboardService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @return array
|
||||
*/
|
||||
public function findAllWithDue($userId) {
|
||||
return $this->dashboardService->findAllWithDue($userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @return array
|
||||
*/
|
||||
public function findAssignedCards($userId) {
|
||||
return $this->dashboardService->findAssignedCards($userId);
|
||||
}
|
||||
}
|
||||
@@ -149,7 +149,7 @@ class CardMapper extends DeckMapper implements IPermissionMapper {
|
||||
return $this->findEntities($sql, [$boardId]);
|
||||
}
|
||||
|
||||
public function findMyAssignedCards($boardId, $username) {
|
||||
public function findAssignedCards($boardId, $username) {
|
||||
$sql = 'SELECT c.* FROM `*PREFIX*deck_cards` c
|
||||
INNER JOIN `*PREFIX*deck_stacks` s ON s.id = c.stack_id
|
||||
INNER JOIN `*PREFIX*deck_boards` b ON b.id = s.board_id
|
||||
|
||||
@@ -583,8 +583,8 @@ class CardService {
|
||||
* @throws \OCA\Deck\NoPermissionException
|
||||
* @throws BadRequestException
|
||||
*/
|
||||
public function findMyAssignedCards($userId) {
|
||||
$cards = $this->cardMapper->findMyAssignedCards($userId);
|
||||
public function findAssignedCards($userId) {
|
||||
$cards = $this->cardMapper->findAssignedCards($userId);
|
||||
|
||||
return $cards;
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ class DashboardService {
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function findMyAssignedCards($userId) {
|
||||
public function findAssignedCards($userId) {
|
||||
$userInfo = $this->getBoardPrerequisites();
|
||||
$userBoards = $this->findAllBoardsFromUser($userInfo);
|
||||
$allAssignedCards = [];
|
||||
@@ -155,7 +155,7 @@ class DashboardService {
|
||||
$cardData = $card->jsonSerialize();
|
||||
$cardData['boardId'] = $userBoard->getId();
|
||||
return $cardData;
|
||||
}, $this->cardMapper->findMyAssignedCards($userBoard->getId(), $this->userId));
|
||||
}, $this->cardMapper->findAssignedCards($userBoard->getId(), $this->userId));
|
||||
}
|
||||
return $allAssignedCards;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user