fix: Add role check for upgrade path (#7374)

Github issue / Community forum post (link here to close automatically):

---------

Co-authored-by: Mutasem <mutdmour@gmail.com>
This commit is contained in:
Ricardo Espinoza
2023-10-09 11:18:08 +02:00
committed by GitHub
parent 3fa27647d8
commit a43f720658
3 changed files with 23 additions and 9 deletions

View File

@@ -55,7 +55,7 @@ import { defineStore } from 'pinia';
import { useRootStore } from '@/stores/n8nRoot.store';
import { getCurlToJson } from '@/api/curlHelper';
import { useWorkflowsStore } from '@/stores/workflows.store';
import { useSettingsStore } from '@/stores/settings.store';
import { useSettingsStore, useUsersStore } from '@/stores/settings.store';
import { useCloudPlanStore } from '@/stores/cloudPlan.store';
import { useTelemetryStore } from '@/stores/telemetry.store';
import { getStyleTokenValue } from '@/utils/htmlUtils';
@@ -346,9 +346,11 @@ export const useUIStore = defineStore(STORES.UI, {
const searchParams = new URLSearchParams();
if (deploymentType === 'cloud') {
const { code } = await useCloudPlanStore().getAutoLoginCode();
const isOwner = useUsersStore().isInstanceOwner;
if (deploymentType === 'cloud' && isOwner) {
const adminPanelHost = new URL(window.location.href).host.split('.').slice(1).join('.');
const { code } = await useCloudPlanStore().getAutoLoginCode();
linkUrl = `https://${adminPanelHost}/login`;
searchParams.set('code', code);
searchParams.set('returnPath', '/account/change-plan');