mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
fix(editor): Do not show project settings for users without permission with direct link (#13246)
This commit is contained in:
parent
c881ea2c7b
commit
fa488f1561
|
@ -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;
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]),
|
]),
|
||||||
|
|
Loading…
Reference in a new issue