feat: RBAC (#8922)

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
Co-authored-by: Val <68596159+valya@users.noreply.github.com>
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
Co-authored-by: Valya Bullions <valya@n8n.io>
Co-authored-by: Danny Martini <danny@n8n.io>
Co-authored-by: Danny Martini <despair.blue@gmail.com>
Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
Co-authored-by: Omar Ajoue <krynble@gmail.com>
Co-authored-by: oleg <me@olegivaniv.com>
Co-authored-by: Michael Kret <michael.k@radency.com>
Co-authored-by: Michael Kret <88898367+michael-radency@users.noreply.github.com>
Co-authored-by: Elias Meire <elias@meire.dev>
Co-authored-by: Giulio Andreini <andreini@netseven.it>
Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
Co-authored-by: Ayato Hayashi <go12limchangyong@gmail.com>
This commit is contained in:
Csaba Tuncsik
2024-05-17 10:53:15 +02:00
committed by GitHub
parent b1f977ebd0
commit 596c472ecc
292 changed files with 14129 additions and 3989 deletions

View File

@@ -20,6 +20,10 @@
<div :class="$style.logo">
<img :src="logoPath" data-test-id="n8n-logo" :class="$style.icon" alt="n8n" />
</div>
<ProjectNavigation
:collapsed="isCollapsed"
:plan-name="cloudPlanStore.currentPlanData?.displayName"
/>
</template>
<template #beforeLowerMenu>
@@ -126,6 +130,7 @@ import { hasPermission } from '@/rbac/permissions';
import { useExternalHooks } from '@/composables/useExternalHooks';
import { useDebounce } from '@/composables/useDebounce';
import { useBecomeTemplateCreatorStore } from '@/components/BecomeTemplateCreatorCta/becomeTemplateCreatorStore';
import ProjectNavigation from '@/features/projects/components/ProjectNavigation.vue';
export default defineComponent({
name: 'MainSidebar',
@@ -134,6 +139,7 @@ export default defineComponent({
ExecutionsUsage,
MainSidebarSourceControl,
BecomeTemplateCreatorCta,
ProjectNavigation,
},
mixins: [userHelpers],
setup(props, ctx) {
@@ -205,31 +211,21 @@ export default defineComponent({
mainMenuItems(): IMenuItem[] {
const items: IMenuItem[] = [];
const workflows: IMenuItem = {
id: 'workflows',
icon: 'network-wired',
label: this.$locale.baseText('mainSidebar.workflows'),
position: 'top',
route: { to: { name: VIEWS.WORKFLOWS } },
secondaryIcon: this.sourceControlStore.preferences.branchReadOnly
? {
name: 'lock',
tooltip: {
content: this.$locale.baseText('mainSidebar.workflows.readOnlyEnv.tooltip'),
},
}
: undefined,
};
const defaultSettingsRoute = this.findFirstAccessibleSettingsRoute();
const regularItems: IMenuItem[] = [
workflows,
{
id: 'cloud-admin',
position: 'bottom',
label: 'Admin Panel',
icon: 'cloud',
available: this.settingsStore.isCloudDeployment && hasPermission(['instanceOwner']),
},
{
// Link to in-app templates, available if custom templates are enabled
id: 'templates',
icon: 'box-open',
label: this.$locale.baseText('mainSidebar.templates'),
position: 'top',
position: 'bottom',
available:
this.settingsStore.isTemplatesEnabled && this.templatesStore.hasCustomTemplatesHost,
route: { to: { name: VIEWS.TEMPLATES } },
@@ -239,7 +235,7 @@ export default defineComponent({
id: 'templates',
icon: 'box-open',
label: this.$locale.baseText('mainSidebar.templates'),
position: 'top',
position: 'bottom',
available:
this.settingsStore.isTemplatesEnabled && !this.templatesStore.hasCustomTemplatesHost,
link: {
@@ -247,35 +243,20 @@ export default defineComponent({
target: '_blank',
},
},
{
id: 'credentials',
icon: 'key',
label: this.$locale.baseText('mainSidebar.credentials'),
customIconSize: 'medium',
position: 'top',
route: { to: { name: VIEWS.CREDENTIALS } },
},
{
id: 'variables',
icon: 'variable',
label: this.$locale.baseText('mainSidebar.variables'),
customIconSize: 'medium',
position: 'top',
position: 'bottom',
route: { to: { name: VIEWS.VARIABLES } },
},
{
id: 'executions',
icon: 'tasks',
label: this.$locale.baseText('mainSidebar.executions'),
position: 'top',
route: { to: { name: VIEWS.EXECUTIONS } },
},
{
id: 'cloud-admin',
position: 'bottom',
label: 'Admin Panel',
icon: 'home',
available: this.settingsStore.isCloudDeployment && hasPermission(['instanceOwner']),
route: { to: { name: VIEWS.EXECUTIONS } },
},
{
id: 'settings',