feat(core): Add license support to n8n (#4566)

* add sdk

* add license manager

* type fix

* add basic func

* store to db

* update default

* activate license

* add sharing flag

* fix setup

* clear license

* update conosle log to info

* refactor

* use npm dependency

* update error logs

* add simple test

* add license tests

* update tests

* update pnpm package

* fix error handling types

* Update packages/cli/src/config/schema.ts

Co-authored-by: Cornelius Suermann <cornelius@n8n.io>

* make feature enum

* add warning

* update sdk

* Update packages/cli/src/config/schema.ts

Co-authored-by: Cornelius Suermann <cornelius@n8n.io>

Co-authored-by: Cornelius Suermann <cornelius@n8n.io>
This commit is contained in:
Mutasem Aldmour
2022-11-21 15:41:24 +01:00
committed by GitHub
parent a9bdc0bbfe
commit 30e5d3d04c
9 changed files with 328 additions and 2 deletions

View File

@@ -13,6 +13,7 @@ import { Role } from '@db/entities/Role';
import { AuthenticatedRequest } from '@/requests';
import config from '@/config';
import { getWebhookBaseUrl } from '../WebhookHelpers';
import { getLicense } from '@/License';
import { WhereClause } from '@/Interfaces';
export async function getWorkflowOwner(workflowId: string | number): Promise<User> {
@@ -41,7 +42,11 @@ export function isUserManagementEnabled(): boolean {
}
export function isSharingEnabled(): boolean {
return isUserManagementEnabled() && config.getEnv('enterprise.features.sharing');
const license = getLicense();
return (
isUserManagementEnabled() &&
(config.getEnv('enterprise.features.sharing') || license.isSharingEnabled())
);
}
export function isUserManagementDisabled(): boolean {