Merge pull request #5745 from nextcloud/bugfix/clone-board-permission
fix: permission check for cloning board
This commit is contained in:
@@ -547,6 +547,10 @@ class BoardService {
|
||||
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);
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
@click="actionEdit">
|
||||
{{ t('deck', 'Edit board') }}
|
||||
</NcActionButton>
|
||||
<NcActionButton v-if="canManage && !board.archived"
|
||||
<NcActionButton v-if="canCreate && !board.archived"
|
||||
:close-after-click="true"
|
||||
@click="actionClone">
|
||||
<template #icon>
|
||||
@@ -148,6 +148,9 @@ import ClickOutside from 'vue-click-outside'
|
||||
import ArchiveIcon from 'vue-material-design-icons/Archive.vue'
|
||||
import CloneIcon from 'vue-material-design-icons/ContentDuplicate.vue'
|
||||
import AccountIcon from 'vue-material-design-icons/Account.vue'
|
||||
import { loadState } from '@nextcloud/initial-state'
|
||||
|
||||
const canCreateState = loadState('deck', 'canCreate')
|
||||
|
||||
export default {
|
||||
name: 'AppNavigationBoard',
|
||||
@@ -185,6 +188,7 @@ export default {
|
||||
editColor: '',
|
||||
isDueSubmenuActive: false,
|
||||
updateDueSetting: null,
|
||||
canCreate: canCreateState,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -253,6 +257,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'))
|
||||
|
||||
Reference in New Issue
Block a user