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) {
|
public function clone($id, $userId) {
|
||||||
$this->boardServiceValidator->check(compact('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);
|
$this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_READ);
|
||||||
|
|
||||||
$board = $this->boardMapper->find($id);
|
$board = $this->boardMapper->find($id);
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
@click="actionEdit">
|
@click="actionEdit">
|
||||||
{{ t('deck', 'Edit board') }}
|
{{ t('deck', 'Edit board') }}
|
||||||
</NcActionButton>
|
</NcActionButton>
|
||||||
<NcActionButton v-if="canManage && !board.archived"
|
<NcActionButton v-if="canCreate && !board.archived"
|
||||||
:close-after-click="true"
|
:close-after-click="true"
|
||||||
@click="actionClone">
|
@click="actionClone">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
@@ -148,6 +148,9 @@ import ClickOutside from 'vue-click-outside'
|
|||||||
import ArchiveIcon from 'vue-material-design-icons/Archive.vue'
|
import ArchiveIcon from 'vue-material-design-icons/Archive.vue'
|
||||||
import CloneIcon from 'vue-material-design-icons/ContentDuplicate.vue'
|
import CloneIcon from 'vue-material-design-icons/ContentDuplicate.vue'
|
||||||
import AccountIcon from 'vue-material-design-icons/Account.vue'
|
import AccountIcon from 'vue-material-design-icons/Account.vue'
|
||||||
|
import { loadState } from '@nextcloud/initial-state'
|
||||||
|
|
||||||
|
const canCreateState = loadState('deck', 'canCreate')
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'AppNavigationBoard',
|
name: 'AppNavigationBoard',
|
||||||
@@ -185,6 +188,7 @@ export default {
|
|||||||
editColor: '',
|
editColor: '',
|
||||||
isDueSubmenuActive: false,
|
isDueSubmenuActive: false,
|
||||||
updateDueSetting: null,
|
updateDueSetting: null,
|
||||||
|
canCreate: canCreateState,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -253,6 +257,9 @@ export default {
|
|||||||
try {
|
try {
|
||||||
const newBoard = await this.$store.dispatch('cloneBoard', this.board)
|
const newBoard = await this.$store.dispatch('cloneBoard', this.board)
|
||||||
this.loading = false
|
this.loading = false
|
||||||
|
if (newBoard instanceof Error) {
|
||||||
|
throw newBoard
|
||||||
|
}
|
||||||
this.$router.push({ name: 'board', params: { id: newBoard.id } })
|
this.$router.push({ name: 'board', params: { id: newBoard.id } })
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
OC.Notification.showTemporary(t('deck', 'An error occurred'))
|
OC.Notification.showTemporary(t('deck', 'An error occurred'))
|
||||||
|
|||||||
Reference in New Issue
Block a user