mirror of
https://github.com/docmost/docmost.git
synced 2026-05-07 06:23:06 +08:00
fix
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
import { atom } from "jotai";
|
import { atomWithStorage } from "jotai/utils";
|
||||||
import type { Entitlements } from "./entitlement.types";
|
import type { Entitlements } from "./entitlement.types";
|
||||||
|
|
||||||
const initialValue: Entitlements | null = null;
|
export const entitlementAtom = atomWithStorage<Entitlements | null>(
|
||||||
export const entitlementAtom = atom(initialValue);
|
"entitlements",
|
||||||
|
null,
|
||||||
|
);
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ export default function Security() {
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{hasSecurityAccess && (
|
{(isCloud() || hasSecurityAccess) && (
|
||||||
<>
|
<>
|
||||||
<AllowedDomains />
|
<AllowedDomains />
|
||||||
<Divider my="lg" />
|
<Divider my="lg" />
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ export class SpaceService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!this.licenseCheckService.hasFeature(workspace.licenseKey, 'security:settings')
|
!this.licenseCheckService.hasFeature(workspace.licenseKey, 'security:settings', workspace.plan)
|
||||||
) {
|
) {
|
||||||
throw new ForbiddenException(
|
throw new ForbiddenException(
|
||||||
'This feature requires a valid license',
|
'This feature requires a valid license',
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ export class WorkspaceService {
|
|||||||
) {
|
) {
|
||||||
const ws = await this.db
|
const ws = await this.db
|
||||||
.selectFrom('workspaces')
|
.selectFrom('workspaces')
|
||||||
.select(['id', 'licenseKey', 'trashRetentionDays'])
|
.select(['id', 'licenseKey', 'plan', 'trashRetentionDays'])
|
||||||
.where('id', '=', workspaceId)
|
.where('id', '=', workspaceId)
|
||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
|
|
||||||
@@ -337,10 +337,24 @@ export class WorkspaceService {
|
|||||||
throw new NotFoundException('Workspace not found');
|
throw new NotFoundException('Workspace not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.licenseCheckService.hasFeature(ws.licenseKey, 'security:settings')) {
|
if (typeof updateWorkspaceDto.mcpEnabled !== 'undefined') {
|
||||||
throw new ForbiddenException(
|
if (!this.licenseCheckService.hasFeature(ws.licenseKey, 'mcp', ws.plan)) {
|
||||||
'This feature requires a valid license',
|
throw new ForbiddenException(
|
||||||
);
|
'This feature requires a valid license',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
typeof updateWorkspaceDto.disablePublicSharing !== 'undefined' ||
|
||||||
|
typeof updateWorkspaceDto.trashRetentionDays !== 'undefined' ||
|
||||||
|
typeof updateWorkspaceDto.restrictApiToAdmins !== 'undefined'
|
||||||
|
) {
|
||||||
|
if (!this.licenseCheckService.hasFeature(ws.licenseKey, 'security:settings', ws.plan)) {
|
||||||
|
throw new ForbiddenException(
|
||||||
|
'This feature requires a valid license',
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|||||||
+1
-1
Submodule apps/server/src/ee updated: a132758491...5082385c45
@@ -26,9 +26,15 @@ export class LicenseCheckService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hasFeature(licenseKey: string, feature: string): boolean {
|
hasFeature(licenseKey: string, feature: string, plan?: string): boolean {
|
||||||
if (this.environmentService.isCloud()) {
|
if (this.environmentService.isCloud()) {
|
||||||
return true;
|
try {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||||
|
const { getFeaturesForCloudPlan } = require('../../ee/licence/feature-registry');
|
||||||
|
return getFeaturesForCloudPlan(plan).has(feature);
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user