Merge remote-tracking branch 'origin/vue' into master-merge-vue
This commit is contained in:
@@ -33,6 +33,7 @@ use OCA\Deck\Db\AssignedUsersMapper;
|
||||
use OCA\Deck\Db\ChangeHelper;
|
||||
use OCA\Deck\Db\IPermissionMapper;
|
||||
use OCA\Deck\Db\Label;
|
||||
use OCA\Deck\Db\Stack;
|
||||
use OCA\Deck\Db\StackMapper;
|
||||
use OCA\Deck\NoPermissionException;
|
||||
use OCA\Deck\Notification\NotificationHelper;
|
||||
@@ -614,6 +615,49 @@ class BoardService {
|
||||
return $delete;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return Board
|
||||
* @throws DoesNotExistException
|
||||
* @throws \OCA\Deck\NoPermissionException
|
||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||
* @throws BadRequestException
|
||||
*/
|
||||
public function clone($id) {
|
||||
|
||||
if (is_numeric($id) === false) {
|
||||
throw new BadRequestException('board id must be a number');
|
||||
}
|
||||
|
||||
$this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_READ);
|
||||
|
||||
$board = $this->boardMapper->find($id);
|
||||
$newBoard = new Board();
|
||||
$newBoard->setTitle($board->getTitle() . ' (' . $this->l10n->t('copy') . ')');
|
||||
$newBoard->setOwner($board->getOwner());
|
||||
$newBoard->setColor($board->getColor());
|
||||
$this->boardMapper->insert($newBoard);
|
||||
|
||||
$labels = $this->labelMapper->findAll($id);
|
||||
foreach ($labels as $label) {
|
||||
$newLabel = new Label();
|
||||
$newLabel->setTitle($label->getTitle());
|
||||
$newLabel->setColor($label->getColor());
|
||||
$newLabel->setBoardId($newBoard->getId());
|
||||
$this->labelMapper->insert($newLabel);
|
||||
}
|
||||
|
||||
$stacks = $this->stackMapper->findAll($id);
|
||||
foreach ($stacks as $stack) {
|
||||
$newStack = new Stack();
|
||||
$newStack->setTitle($stack->getTitle());
|
||||
$newStack->setBoardId($newBoard->getId());
|
||||
$this->stackMapper->insert($newStack);
|
||||
}
|
||||
|
||||
return $newBoard;
|
||||
}
|
||||
|
||||
private function enrichWithStacks($board, $since = -1) {
|
||||
$stacks = $this->stackMapper->findAll($board->getId(), null, null, $since);
|
||||
|
||||
|
||||
@@ -400,6 +400,14 @@ class CardService {
|
||||
if ($this->boardService->isArchived($this->cardMapper, $id)) {
|
||||
throw new StatusException('Operation not allowed. This board is archived.');
|
||||
}
|
||||
|
||||
$card = $this->cardMapper->find($id);
|
||||
if ($card->getArchived()) {
|
||||
throw new StatusException('Operation not allowed. This card is archived.');
|
||||
}
|
||||
$card->setStackId($stackId);
|
||||
$this->cardMapper->update($card);
|
||||
|
||||
$cards = $this->cardMapper->findAll($stackId);
|
||||
$result = [];
|
||||
$i = 0;
|
||||
|
||||
@@ -262,6 +262,27 @@ class PermissionService {
|
||||
$users[$user->getUID()] = new User($user);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->circlesEnabled && $acl->getType() === Acl::PERMISSION_TYPE_CIRCLE) {
|
||||
try {
|
||||
$circle = \OCA\Circles\Api\v1\Circles::detailsCircle($acl->getParticipant(), true);
|
||||
if ($circle === null) {
|
||||
$this->logger->info('No circle found for acl rule ' . $acl->getId());
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($circle->getMembers() as $member) {
|
||||
$user = $this->userManager->get($member->getUserId());
|
||||
if ($user === null) {
|
||||
$this->logger->info('No user found for circle member ' . $member->getUserId());
|
||||
} else {
|
||||
$users[$member->getUserId()] = new User($user);
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->info('Member not found in circle that was accessed. This should not happen.');
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->users[(string) $boardId] = $users;
|
||||
return $this->users[(string) $boardId];
|
||||
|
||||
Reference in New Issue
Block a user