diff --git a/packages/editor-ui/src/views/NodeView.v2.vue b/packages/editor-ui/src/views/NodeView.v2.vue index 327ee259e596a..9446dc13910f1 100644 --- a/packages/editor-ui/src/views/NodeView.v2.vue +++ b/packages/editor-ui/src/views/NodeView.v2.vue @@ -96,6 +96,7 @@ import { createEventBus } from 'n8n-design-system'; import type { PinDataSource } from '@/composables/usePinnedData'; import { useClipboard } from '@/composables/useClipboard'; import { useBeforeUnload } from '@/composables/useBeforeUnload'; +import { getResourcePermissions } from '@/permissions'; const LazyNodeCreation = defineAsyncComponent( async () => await import('@/components/Node/NodeCreation.vue'), @@ -203,7 +204,11 @@ const isReadOnlyEnvironment = computed(() => { }); const isCanvasReadOnly = computed(() => { - return isDemoRoute.value || isReadOnlyEnvironment.value; + return ( + isDemoRoute.value || + isReadOnlyEnvironment.value || + !(workflowPermissions.value.update ?? projectPermissions.value.workflow.update) + ); }); const fallbackNodes = computed(() => @@ -885,6 +890,21 @@ function onClickConnectionAdd(connection: Connection) { }); } +/** + * Permissions + */ + +const workflowPermissions = computed(() => { + return getResourcePermissions(workflowsStore.getWorkflowById(workflowId.value)?.scopes).workflow; +}); + +const projectPermissions = computed(() => { + const project = route.query?.projectId + ? projectsStore.myProjects.find((p) => p.id === route.query.projectId) + : projectsStore.currentProject ?? projectsStore.personalProject; + return getResourcePermissions(project?.scopes); +}); + /** * Executions */ @@ -1516,7 +1536,7 @@ onDeactivated(() => { @create:workflow="onCreateWorkflow" @viewport-change="onViewportChange" > -
+