diff --git a/desktop/src/ui/platform.ts b/desktop/src/ui/platform.ts index f655efd6d66..c4c64d5210f 100644 --- a/desktop/src/ui/platform.ts +++ b/desktop/src/ui/platform.ts @@ -360,6 +360,9 @@ export async function configurePlatform (onWorkbenchConnect?: () => Promise it.trim()).filter(it => it.length > 0) + setMetadata(presentation.metadata.DisabledFeatures, new Set(disabledFeatures)) + setMetadata(textEditor.metadata.Collaborator, config.COLLABORATOR ?? '') setMetadata(github.metadata.GithubApplication, config.GITHUB_APP ?? '') @@ -508,6 +511,7 @@ export async function configurePlatform (onWorkbenchConnect?: () => Promise await import(/* webpackChunkName: "rating" */ '@hcengineering/rating-resources')) setMetadata(client.metadata.FilterModel, 'ui') + setMetadata(client.metadata.ExtraFilter, disabledFeatures) setMetadata(client.metadata.ExtraPlugins, ['preference' as Plugin]) // Use binary response transfer for faster performance and small transfer sizes. diff --git a/desktop/src/ui/types.ts b/desktop/src/ui/types.ts index aac962d8ae1..e1919c4121e 100644 --- a/desktop/src/ui/types.ts +++ b/desktop/src/ui/types.ts @@ -69,6 +69,7 @@ export interface Config { PASSWORD_STRICTNESS?: 'very_strict' | 'strict' | 'normal' | 'none' EXCLUDED_APPLICATIONS_FOR_ANONYMOUS?: string HULYLAKE_URL?: string + DISABLED_FEATURES?: string } export interface Branding { diff --git a/dev/prod/src/platform.ts b/dev/prod/src/platform.ts index 726ecf2fca9..c0796af6bc1 100644 --- a/dev/prod/src/platform.ts +++ b/dev/prod/src/platform.ts @@ -201,6 +201,7 @@ export interface Config { EXCLUDED_APPLICATIONS_FOR_ANONYMOUS?: string PULSE_URL?: string HULYLAKE_URL?: string + DISABLED_FEATURES?: string } export interface Branding { @@ -479,10 +480,15 @@ export async function configurePlatform() { setMetadata(presentation.metadata.StatsUrl, config.STATS_URL) setMetadata(presentation.metadata.LinkPreviewUrl, config.LINK_PREVIEW_URL) setMetadata(presentation.metadata.MailUrl, config.MAIL_URL) + + const disabledFeatures = (config.DISABLED_FEATURES ??'').split(',').map(it => it.trim()).filter(it => it.length > 0) + setMetadata(presentation.metadata.DisabledFeatures, new Set(disabledFeatures)) + setMetadata(recorder.metadata.StreamUrl, config.STREAM_URL) setMetadata(textEditor.metadata.Collaborator, config.COLLABORATOR) setMetadata(communication.metadata.Enabled, config.COMMUNICATION_API_ENABLED === 'true') + if (config.MODEL_VERSION != null) { console.log('Minimal Model version requirement', config.MODEL_VERSION) setMetadata(presentation.metadata.ModelVersion, config.MODEL_VERSION) @@ -695,6 +701,7 @@ export async function configurePlatform() { addLocation(ratingId, async () => await import(/* webpackChunkName: "rating" */ '@hcengineering/rating-resources')) setMetadata(client.metadata.FilterModel, 'ui') + setMetadata(client.metadata.ExtraFilter, disabledFeatures) setMetadata(client.metadata.ExtraPlugins, ['preference' as Plugin]) setMetadata(login.metadata.TransactorOverride, config.TRANSACTOR_OVERRIDE) diff --git a/docs/disableFeatures.md b/docs/disableFeatures.md new file mode 100644 index 00000000000..be16cd915a6 --- /dev/null +++ b/docs/disableFeatures.md @@ -0,0 +1,28 @@ +# Overview + +A configuration guide, for self-hosted users. + +## Disable features +Installation could have force disabled one of unused features for all workspaces. + +Please set a DISABLED_FEATURES environment variable for front service container, a comma separated list is supported. + +- auto-translate - Will disable auto translate +- github - Will disable Github +- mailboxes - Will disable Huly Mail +- export - Will disable export +- integration - Will disable all integrations +- backup - Will disable backup UI +- invites - Will disable invites UI +- documents - Will disable Control Documents +- calendar - Will disable Calendar UI +- inventory - Will disable inventory +- survey - Will disable Surveys +- lead - Will disable leada +- products - Will disable products +- telegram - Will disable telegram +- recruit - Will disable Recruit +- training - Will disable trainings +- testManagement - Will disable test management +- process - Will disable process module +- cards - Will disable cards diff --git a/models/billing/src/index.ts b/models/billing/src/index.ts index b94a3e65d63..54d65f6c675 100644 --- a/models/billing/src/index.ts +++ b/models/billing/src/index.ts @@ -48,6 +48,7 @@ export function createModel (builder: Builder): void { component: billing.component.Settings, group: 'settings-editor', role: AccountRole.Owner, + feature: 'billing', order: 920 }) diff --git a/models/contact/src/index.ts b/models/contact/src/index.ts index 1fd543efe22..cc639f0501f 100644 --- a/models/contact/src/index.ts +++ b/models/contact/src/index.ts @@ -1425,6 +1425,7 @@ export function createModel (builder: Builder): void { component: contact.component.TranslationSettings, group: 'settings-account', role: AccountRole.Guest, + feature: 'auto-translate', order: 1600 }) } diff --git a/models/love/src/index.ts b/models/love/src/index.ts index cb7139738f9..97abdabe059 100644 --- a/models/love/src/index.ts +++ b/models/love/src/index.ts @@ -343,6 +343,7 @@ export function createModel (builder: Builder): void { component: love.component.Settings, group: 'settings-account', role: AccountRole.Guest, + feature: 'love', order: 1600 }, love.ids.Settings diff --git a/models/setting/src/index.ts b/models/setting/src/index.ts index 5fd1b7675aa..4a9e817d12a 100644 --- a/models/setting/src/index.ts +++ b/models/setting/src/index.ts @@ -216,6 +216,7 @@ export function createModel (builder: Builder): void { component: setting.component.Integrations, group: 'settings-account', role: AccountRole.User, + feature: 'integrations', order: 1500 }, setting.ids.Integrations @@ -229,6 +230,7 @@ export function createModel (builder: Builder): void { icon: setting.icon.Mailbox, component: setting.component.Mailboxes, group: 'settings-account', + feature: 'mailboxes', role: AccountRole.User, order: 1700 }, @@ -255,6 +257,7 @@ export function createModel (builder: Builder): void { label: setting.string.Backup, icon: setting.icon.Setting, component: setting.component.Backup, + feature: 'backup', order: 950, role: AccountRole.Owner }, @@ -351,6 +354,7 @@ export function createModel (builder: Builder): void { icon: setting.icon.InviteSettings, component: setting.component.InviteSetting, group: 'settings-editor', + feature: 'invites', role: AccountRole.Maintainer, order: 4700 }, @@ -365,6 +369,7 @@ export function createModel (builder: Builder): void { icon: exportPlugin.icon.Export, component: exportPlugin.component.ExportSettings, group: 'settings-editor', + feature: 'export', role: AccountRole.User, order: 4800 }, diff --git a/models/templates/src/index.ts b/models/templates/src/index.ts index 36ade62388a..0073a90c50c 100644 --- a/models/templates/src/index.ts +++ b/models/templates/src/index.ts @@ -76,6 +76,7 @@ export function createModel (builder: Builder): void { icon: templates.icon.Templates, component: templates.component.Templates, group: 'settings-editor', + feature: 'templates', role: AccountRole.User, order: 3500 }, diff --git a/models/training/src/index.ts b/models/training/src/index.ts index edaf0c0cbdc..b91f8686cd8 100644 --- a/models/training/src/index.ts +++ b/models/training/src/index.ts @@ -893,6 +893,7 @@ function defineSettings (builder: Builder): void { icon: training.icon.Training, component: training.component.Settings, order: 1150, + feature: 'trainings', role: AccountRole.Maintainer }, training.setting.Trainings diff --git a/packages/presentation/src/plugin.ts b/packages/presentation/src/plugin.ts index 67e40485076..e750e99d756 100644 --- a/packages/presentation/src/plugin.ts +++ b/packages/presentation/src/plugin.ts @@ -183,6 +183,7 @@ export default plugin(presentationId, { SessionId: '' as Metadata, StatsUrl: '' as Metadata, MailUrl: '' as Metadata, + DisabledFeatures: '' as Metadata>, PreviewUrl: '' as Metadata, PulseUrl: '' as Metadata, HulylakeUrl: '' as Metadata, diff --git a/packages/presentation/src/utils.ts b/packages/presentation/src/utils.ts index 2e2a9ae58d5..43b320c19e9 100644 --- a/packages/presentation/src/utils.ts +++ b/packages/presentation/src/utils.ts @@ -254,6 +254,13 @@ export function getClient (): TxOperations & Client { return clientProxy } +export function isDisabled (feature?: string): boolean { + if (feature === undefined) { + return false + } + return getMetadata(plugin.metadata.DisabledFeatures)?.has(feature) ?? false +} + export type OnClientListener = (client: Client, account: Account) => void | Promise const onClientListeners: OnClientListener[] = [] diff --git a/plugins/setting-resources/src/components/Configure.svelte b/plugins/setting-resources/src/components/Configure.svelte index 2640d3865ed..8e03c0e6bf6 100644 --- a/plugins/setting-resources/src/components/Configure.svelte +++ b/plugins/setting-resources/src/components/Configure.svelte @@ -14,7 +14,14 @@ -->