diff --git a/models/setting/src/index.ts b/models/setting/src/index.ts index 25a624a0a4..f2c3212265 100644 --- a/models/setting/src/index.ts +++ b/models/setting/src/index.ts @@ -59,6 +59,7 @@ export class TSettingsCategory extends TDoc implements SettingsCategory { icon!: Asset component!: AnyComponent secured!: boolean + adminOnly?: boolean } @Model(setting.class.WorkspaceSettingCategory, core.class.Doc, DOMAIN_MODEL) @@ -199,7 +200,8 @@ export function createModel (builder: Builder): void { icon: setting.icon.Setting, component: setting.component.Configure, order: 1001, - secured: true + secured: true, + adminOnly: true }, setting.ids.Configure ) diff --git a/packages/presentation/src/utils.ts b/packages/presentation/src/utils.ts index 7a5b5eddd8..f9191cb113 100644 --- a/packages/presentation/src/utils.ts +++ b/packages/presentation/src/utils.ts @@ -524,3 +524,18 @@ export function getFiltredKeys ( export function isCollectionAttr (hierarchy: Hierarchy, key: KeyedAttribute): boolean { return hierarchy.isDerived(key.attr.type._class, core.class.Collection) } + +/** + * @public + */ +export function decodeTokenPayload (token: string): any { + const parts = token.split('.') + + const payload = parts[1] + + const decodedPayload = atob(payload) + + const parsedPayload = JSON.parse(decodedPayload) + + return parsedPayload +} diff --git a/plugins/guest-resources/src/components/Guest.svelte b/plugins/guest-resources/src/components/Guest.svelte index da11d660b7..44ba9636b7 100644 --- a/plugins/guest-resources/src/components/Guest.svelte +++ b/plugins/guest-resources/src/components/Guest.svelte @@ -16,7 +16,7 @@ import { Analytics } from '@hcengineering/analytics' import core, { Class, Doc, Ref, Space } from '@hcengineering/core' import { getMetadata, getResource } from '@hcengineering/platform' - import { ActionContext, getClient } from '@hcengineering/presentation' + import { ActionContext, decodeTokenPayload, getClient } from '@hcengineering/presentation' import { AnyComponent, Component, @@ -41,7 +41,6 @@ import workbench, { Application, NavigatorModel, SpecialNavModel, ViewConfiguration } from '@hcengineering/workbench' import { buildNavModel, SpaceView } from '@hcengineering/workbench-resources' import guest from '../plugin' - import { decodeTokenPayload } from '../utils' const excludedApps = getMetadata(workbench.metadata.ExcludedApplications) ?? [] diff --git a/plugins/guest-resources/src/utils.ts b/plugins/guest-resources/src/utils.ts deleted file mode 100644 index e6b56829fa..0000000000 --- a/plugins/guest-resources/src/utils.ts +++ /dev/null @@ -1,11 +0,0 @@ -export function decodeTokenPayload (token: string): any { - const parts = token.split('.') - - const payload = parts[1] - - const decodedPayload = atob(payload) - - const parsedPayload = JSON.parse(decodedPayload) - - return parsedPayload -} diff --git a/plugins/setting-resources/src/components/WorkspaceSettings.svelte b/plugins/setting-resources/src/components/WorkspaceSettings.svelte index 10f89a4067..8cf6fddfc0 100644 --- a/plugins/setting-resources/src/components/WorkspaceSettings.svelte +++ b/plugins/setting-resources/src/components/WorkspaceSettings.svelte @@ -15,7 +15,7 @@