refactor(core)!: Remove basic-auth, external-jwt-auth, and no-auth options (#6362)

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
Iván Ovejero
2023-06-07 16:53:53 +02:00
committed by कारतोफ्फेलस्क्रिप्ट™
parent a45a2c8c41
commit 8c008f5d22
85 changed files with 297 additions and 831 deletions

View File

@@ -142,7 +142,7 @@ export default defineComponent({
},
authenticate() {
// redirect to setup page. user should be redirected to this only once
if (this.settingsStore.isUserManagementEnabled && this.settingsStore.showSetupPage) {
if (this.settingsStore.showSetupPage) {
if (this.$route.name === VIEWS.SETUP) {
return;
}

View File

@@ -38,10 +38,6 @@ export async function setupOwner(
return makeRestApiRequest(context, 'POST', '/owner/setup', params as unknown as IDataObject);
}
export async function skipOwnerSetup(context: IRestApiContext): Promise<void> {
return makeRestApiRequest(context, 'POST', '/owner/skip-setup');
}
export async function validateSignupToken(
context: IRestApiContext,
params: { inviterId: string; inviteeId: string },

View File

@@ -89,6 +89,7 @@
<n8n-action-dropdown
:items="userMenuItems"
placement="top-start"
data-test-id="user-menu"
@select="onUserActionToggle"
/>
</div>
@@ -171,11 +172,7 @@ export default defineComponent({
return accessibleRoute !== null;
},
showUserArea(): boolean {
return (
this.settingsStore.isUserManagementEnabled &&
this.usersStore.canUserAccessSidebarUserInfo &&
this.usersStore.currentUser !== null
);
return this.usersStore.canUserAccessSidebarUserInfo && this.usersStore.currentUser !== null;
},
workflowExecution(): IExecutionResponse | null {
return this.workflowsStore.getWorkflowExecution;

View File

@@ -95,15 +95,11 @@
"auth.setup.createAccount": "Create account",
"auth.setup.goBack": "Go back",
"auth.setup.next": "Next",
"auth.setup.ownerAccountBenefits": "Setting up an owner account allows you to invite others, and prevents people using n8n without an account",
"auth.setup.settingUpOwnerError": "Problem setting up owner",
"auth.setup.setupConfirmation.concatEntities": "{workflows} and {credentials}",
"auth.setup.setupConfirmation.credentials": "{count} credential | {count} credentials",
"auth.setup.setupConfirmation.existingWorkflows": "{count} existing workflow | {count} existing workflows",
"auth.setup.setupOwner": "Set up owner account",
"auth.setup.skipOwnerSetupQuestion": "Skip owner account setup?",
"auth.setup.skipSetup": "Skip setup",
"auth.setup.skipSetupTemporarily": "Skip setup for now",
"auth.signin": "Sign in",
"auth.signin.error": "Problem logging in",
"auth.signout": "Sign out",

View File

@@ -416,12 +416,6 @@ export const routes = [
allow: {
role: [ROLE.Default],
},
deny: {
shouldDeny: () => {
const settingsStore = useSettingsStore();
return settingsStore.isUserManagementEnabled === false;
},
},
},
},
},
@@ -537,17 +531,7 @@ export const routes = [
},
permissions: {
allow: {
role: [ROLE.Default, ROLE.Owner],
},
deny: {
shouldDeny: () => {
const settingsStore = useSettingsStore();
return (
settingsStore.isUserManagementEnabled === false &&
!(settingsStore.isCloudDeployment || settingsStore.isDesktopDeployment)
);
},
role: [ROLE.Owner],
},
},
},
@@ -645,7 +629,7 @@ export const routes = [
},
permissions: {
allow: {
role: [ROLE.Default, ROLE.Owner],
role: [ROLE.Owner],
},
deny: {
role: [ROLE.Member],
@@ -665,7 +649,7 @@ export const routes = [
},
permissions: {
allow: {
role: [ROLE.Default, ROLE.Owner],
role: [ROLE.Owner],
},
deny: {
shouldDeny: () => {
@@ -707,7 +691,7 @@ export const routes = [
meta: {
permissions: {
allow: {
role: [ROLE.Default, ROLE.Owner],
role: [ROLE.Owner],
},
deny: {
role: [ROLE.Member],

View File

@@ -37,7 +37,6 @@ export const useSettingsStore = defineStore(STORES.SETTINGS, {
settings: {} as IN8nUISettings,
promptsData: {} as IN8nPrompts,
userManagement: {
enabled: false,
showSetupOnFirstLoad: false,
smtpSetup: false,
authenticationMethod: UserManagementAuthenticationMethod.Email,
@@ -71,9 +70,6 @@ export const useSettingsStore = defineStore(STORES.SETTINGS, {
versionCli(): string {
return this.settings.versionCli;
},
isUserManagementEnabled(): boolean {
return this.userManagement.enabled;
},
isPublicApiEnabled(): boolean {
return this.api.enabled;
},

View File

@@ -13,7 +13,6 @@ import {
sendForgotPasswordEmail,
setupOwner,
signup,
skipOwnerSetup,
submitPersonalizationSurvey,
updateCurrentUser,
updateCurrentUserPassword,
@@ -332,13 +331,5 @@ export const useUsersStore = defineStore(STORES.USERS, {
uiStore.openModal(PERSONALIZATION_MODAL_KEY);
}
},
async skipOwnerSetup(): Promise<void> {
try {
const rootStore = useRootStore();
const settingsStore = useSettingsStore();
settingsStore.stopShowingSetupPage();
await skipOwnerSetup(rootStore.getRestApiContext);
} catch (error) {}
},
},
});

View File

@@ -5,7 +5,6 @@ import type { IWorkflowSettings } from 'n8n-workflow';
import { defineStore } from 'pinia';
import { useRootStore } from './n8nRoot.store';
import { useNDVStore } from './ndv.store';
import { useSettingsStore } from './settings.store';
import { useUIStore } from './ui.store';
import { useUsersStore } from './users.store';
import { useWorkflowsStore } from './workflows.store';
@@ -21,9 +20,6 @@ export const useWebhooksStore = defineStore(STORES.WEBHOOKS, {
getFakeDoorFeatures() {
return useUIStore().fakeDoorFeatures;
},
isUserManagementEnabled() {
return useSettingsStore().isUserManagementEnabled;
},
getFakeDoorItems(): IFakeDoor[] {
return useUIStore().fakeDoorFeatures;
},

View File

@@ -101,7 +101,7 @@ export const PERMISSIONS: IUserPermissions = {
TAGS: {
CAN_DELETE_TAGS: {
allow: {
role: [ROLE.Owner, ROLE.Default],
role: [ROLE.Owner],
},
},
},
@@ -125,7 +125,7 @@ export const PERMISSIONS: IUserPermissions = {
USAGE: {
CAN_ACTIVATE_LICENSE: {
allow: {
role: [ROLE.Owner, ROLE.Default],
role: [ROLE.Owner],
},
},
},

View File

@@ -19,23 +19,7 @@
</n8n-tooltip>
</div>
</div>
<div v-if="!settingsStore.isUserManagementEnabled" :class="$style.setupInfoContainer">
<n8n-action-box
:heading="
$locale.baseText(uiStore.contextBasedTranslationKeys.users.settings.unavailable.title)
"
:description="
$locale.baseText(
uiStore.contextBasedTranslationKeys.users.settings.unavailable.description,
)
"
:buttonText="
$locale.baseText(uiStore.contextBasedTranslationKeys.users.settings.unavailable.button)
"
@click="goToUpgrade"
/>
</div>
<div v-else-if="usersStore.showUMSetupWarning" :class="$style.setupInfoContainer">
<div v-if="usersStore.showUMSetupWarning" :class="$style.setupInfoContainer">
<n8n-action-box
:heading="$locale.baseText('settings.users.setupToInviteUsers')"
:buttonText="$locale.baseText('settings.users.setupMyAccount')"

View File

@@ -4,7 +4,6 @@
:formLoading="loading"
data-test-id="setup-form"
@submit="onSubmit"
@secondaryClick="showSkipConfirmation"
/>
</template>
@@ -41,7 +40,6 @@ export default defineComponent({
const FORM_CONFIG: IFormBoxConfig = {
title: this.$locale.baseText('auth.setup.setupOwner'),
buttonText: this.$locale.baseText('auth.setup.next'),
secondaryButtonText: this.$locale.baseText('auth.setup.skipSetupTemporarily'),
inputs: [
{
name: 'email',
@@ -177,25 +175,6 @@ export default defineComponent({
}
this.loading = false;
},
async showSkipConfirmation() {
const skip = await this.confirm(
this.$locale.baseText('auth.setup.ownerAccountBenefits'),
this.$locale.baseText('auth.setup.skipOwnerSetupQuestion'),
{
confirmButtonText: this.$locale.baseText('auth.setup.skipSetup'),
cancelButtonText: this.$locale.baseText('auth.setup.goBack'),
},
);
if (skip === MODAL_CONFIRM) {
this.onSkip();
}
},
onSkip() {
void this.usersStore.skipOwnerSetup();
void this.$router.push({
name: VIEWS.NEW_WORKFLOW,
});
},
},
});
</script>

View File

@@ -78,7 +78,7 @@ export default defineComponent({
],
};
if (!this.settingsStore.isDesktopDeployment || this.settingsStore.isUserManagementEnabled) {
if (!this.settingsStore.isDesktopDeployment) {
this.FORM_CONFIG.redirectLink = '/forgot-password';
}
},