mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(editor): Do not show project settings for users without permission with direct link (#13246)
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
import type { RouteRecordRaw } from 'vue-router';
|
import type { RouteRecordRaw } from 'vue-router';
|
||||||
import { VIEWS } from '@/constants';
|
import { VIEWS } from '@/constants';
|
||||||
|
import { useProjectsStore } from '@/stores/projects.store';
|
||||||
|
import { getResourcePermissions } from '@/permissions';
|
||||||
|
|
||||||
const MainSidebar = async () => await import('@/components/MainSidebar.vue');
|
const MainSidebar = async () => await import('@/components/MainSidebar.vue');
|
||||||
const WorkflowsView = async () => await import('@/views/WorkflowsView.vue');
|
const WorkflowsView = async () => await import('@/views/WorkflowsView.vue');
|
||||||
@@ -95,7 +97,15 @@ export const projectsRoutes: RouteRecordRaw[] = [
|
|||||||
sidebar: MainSidebar,
|
sidebar: MainSidebar,
|
||||||
},
|
},
|
||||||
meta: {
|
meta: {
|
||||||
middleware: ['authenticated'],
|
middleware: ['authenticated', 'custom'],
|
||||||
|
middlewareOptions: {
|
||||||
|
custom: (options) => {
|
||||||
|
const project = useProjectsStore().myProjects.find(
|
||||||
|
(p) => p.id === options?.to.params.projectId,
|
||||||
|
);
|
||||||
|
return !!getResourcePermissions(project?.scopes).project.update;
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]),
|
]),
|
||||||
|
|||||||
Reference in New Issue
Block a user