Merge pull request #1866 from nextcloud/fix/boardClonePermission
This commit is contained in:
@@ -153,6 +153,6 @@ class BoardController extends ApiController {
|
||||
* @return \OCP\Deck\DB\Board
|
||||
*/
|
||||
public function clone($boardId) {
|
||||
return $this->boardService->clone($boardId);
|
||||
return $this->boardService->clone($boardId, $this->userId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -621,13 +621,14 @@ class BoardService {
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @param $userId
|
||||
* @return Board
|
||||
* @throws DoesNotExistException
|
||||
* @throws \OCA\Deck\NoPermissionException
|
||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
|
||||
* @throws BadRequestException
|
||||
*/
|
||||
public function clone($id) {
|
||||
public function clone($id, $userId) {
|
||||
if (is_numeric($id) === false) {
|
||||
throw new BadRequestException('board id must be a number');
|
||||
}
|
||||
@@ -637,7 +638,7 @@ class BoardService {
|
||||
$board = $this->boardMapper->find($id);
|
||||
$newBoard = new Board();
|
||||
$newBoard->setTitle($board->getTitle() . ' (' . $this->l10n->t('copy') . ')');
|
||||
$newBoard->setOwner($board->getOwner());
|
||||
$newBoard->setOwner($userId);
|
||||
$newBoard->setColor($board->getColor());
|
||||
$permissions = $this->permissionService->matchPermissions($board);
|
||||
$newBoard->setPermissions([
|
||||
|
||||
@@ -149,6 +149,7 @@ export default {
|
||||
text: t('deck', 'Edit board'),
|
||||
})
|
||||
}
|
||||
if (canManage) {
|
||||
|
||||
actions.push({
|
||||
action: async() => {
|
||||
@@ -168,7 +169,7 @@ export default {
|
||||
icon: 'icon-clone',
|
||||
text: t('deck', 'Clone board'),
|
||||
})
|
||||
if (canManage) {
|
||||
|
||||
if (!this.board.archived) {
|
||||
actions.push({
|
||||
action: () => {
|
||||
|
||||
Reference in New Issue
Block a user