Skip to content

Commit

Permalink
fix: permission check for cloning board
Browse files Browse the repository at this point in the history
Signed-off-by: Luka Trovic <[email protected]>
  • Loading branch information
luka-nextcloud committed Apr 10, 2024
1 parent 4d51b14 commit 3323a21
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/Service/BoardService.php
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,10 @@ public function deleteAcl(int $id): ?Acl {
public function clone($id, $userId) {
$this->boardServiceValidator->check(compact('id', 'userId'));

if (!$this->permissionService->canCreate()) {
throw new NoPermissionException('Creating boards has been disabled for your account.');
}

$this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_READ);

$board = $this->boardMapper->find($id);
Expand Down
3 changes: 3 additions & 0 deletions src/components/navigation/AppNavigationBoard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ export default {
try {
const newBoard = await this.$store.dispatch('cloneBoard', this.board)
this.loading = false
if (newBoard instanceof Error) {
throw newBoard
}
this.$router.push({ name: 'board', params: { id: newBoard.id } })
} catch (e) {
OC.Notification.showTemporary(t('deck', 'An error occurred'))
Expand Down

0 comments on commit 3323a21

Please sign in to comment.