mirror of
https://github.com/docmost/docmost.git
synced 2026-05-06 22:03:06 +08:00
fix
This commit is contained in:
@@ -14,4 +14,6 @@ export const Feature = {
|
||||
SCIM: 'scim',
|
||||
PAGE_VERIFICATION: 'page:verification',
|
||||
AUDIT_LOGS: 'audit:logs',
|
||||
RETENTION: 'retention',
|
||||
SHARING_CONTROLS: 'sharing:controls',
|
||||
} as const;
|
||||
|
||||
@@ -33,7 +33,7 @@ function DisablePublicSharingToggle() {
|
||||
const [checked, setChecked] = useState(
|
||||
workspace?.settings?.sharing?.disabled === true,
|
||||
);
|
||||
const hasAccess = useHasFeature(Feature.SECURITY_SETTINGS);
|
||||
const hasSharingControls = useHasFeature(Feature.SHARING_CONTROLS);
|
||||
const upgradeLabel = useUpgradeLabel();
|
||||
|
||||
const applyChange = async (value: boolean) => {
|
||||
@@ -75,11 +75,11 @@ function DisablePublicSharingToggle() {
|
||||
};
|
||||
|
||||
return (
|
||||
<Tooltip label={upgradeLabel} disabled={hasAccess} refProp="rootRef">
|
||||
<Tooltip label={upgradeLabel} disabled={hasSharingControls} refProp="rootRef">
|
||||
<Switch
|
||||
checked={checked}
|
||||
onChange={handleChange}
|
||||
disabled={!hasAccess}
|
||||
disabled={!hasSharingControls}
|
||||
aria-label={t("Toggle public sharing")}
|
||||
/>
|
||||
</Tooltip>
|
||||
|
||||
@@ -36,7 +36,7 @@ export function EnforceSsoToggle({ size, label }: EnforceSsoToggleProps) {
|
||||
const { t } = useTranslation();
|
||||
const [workspace, setWorkspace] = useAtom(workspaceAtom);
|
||||
const [checked, setChecked] = useState(workspace?.enforceSso);
|
||||
const hasAccess = useHasFeature(Feature.SECURITY_SETTINGS);
|
||||
const hasAccess = useHasFeature(Feature.SSO_CUSTOM);
|
||||
const upgradeLabel = useUpgradeLabel();
|
||||
|
||||
const handleChange = async (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
|
||||
@@ -6,6 +6,9 @@ import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { ISpace } from "@/features/space/types/space.types.ts";
|
||||
import { useUpdateSpaceMutation } from "@/features/space/queries/space-query.ts";
|
||||
import { useHasFeature } from "@/ee/hooks/use-feature.ts";
|
||||
import { Feature } from "@/ee/features.ts";
|
||||
import { useUpgradeLabel } from "@/ee/hooks/use-upgrade-label.ts";
|
||||
|
||||
type SpacePublicSharingToggleProps = {
|
||||
space: ISpace;
|
||||
@@ -17,6 +20,9 @@ export default function SpacePublicSharingToggle({
|
||||
const { t } = useTranslation();
|
||||
const [workspace] = useAtom(workspaceAtom);
|
||||
const workspaceDisabled = workspace?.settings?.sharing?.disabled === true;
|
||||
const hasSharingControls = useHasFeature(Feature.SHARING_CONTROLS);
|
||||
const upgradeLabel = useUpgradeLabel();
|
||||
const isDisabled = !hasSharingControls || workspaceDisabled;
|
||||
const [checked, setChecked] = useState(
|
||||
space.settings?.sharing?.disabled === true,
|
||||
);
|
||||
@@ -68,14 +74,14 @@ export default function SpacePublicSharingToggle({
|
||||
</Text>
|
||||
</div>
|
||||
<Tooltip
|
||||
label={t("Public sharing is disabled at the workspace level")}
|
||||
disabled={!workspaceDisabled}
|
||||
label={!hasSharingControls ? upgradeLabel : t("Public sharing is disabled at the workspace level")}
|
||||
disabled={!isDisabled}
|
||||
refProp="rootRef"
|
||||
>
|
||||
<Switch
|
||||
checked={checked}
|
||||
onChange={handleChange}
|
||||
disabled={workspaceDisabled}
|
||||
disabled={isDisabled}
|
||||
aria-label={t("Toggle space public sharing")}
|
||||
/>
|
||||
</Tooltip>
|
||||
|
||||
@@ -41,7 +41,7 @@ function retentionToDays(amount: number, unit: RetentionUnit): number {
|
||||
|
||||
export default function TrashRetention() {
|
||||
const { t } = useTranslation();
|
||||
const hasAccess = useHasFeature(Feature.SECURITY_SETTINGS);
|
||||
const hasRetention = useHasFeature(Feature.RETENTION);
|
||||
const upgradeLabel = useUpgradeLabel();
|
||||
const [workspace, setWorkspace] = useAtom(workspaceAtom);
|
||||
|
||||
@@ -107,7 +107,7 @@ export default function TrashRetention() {
|
||||
{t("Pages in trash will be permanently deleted after this period.")}
|
||||
</Text>
|
||||
|
||||
<Tooltip label={upgradeLabel} disabled={hasAccess}>
|
||||
<Tooltip label={upgradeLabel} disabled={hasRetention}>
|
||||
<Group gap="xs" wrap="nowrap" maw={320}>
|
||||
<NumberInput
|
||||
value={retentionAmount}
|
||||
@@ -116,7 +116,7 @@ export default function TrashRetention() {
|
||||
hideControls
|
||||
size="sm"
|
||||
w={60}
|
||||
disabled={!hasAccess}
|
||||
disabled={!hasRetention}
|
||||
/>
|
||||
<Select
|
||||
data={[
|
||||
@@ -132,13 +132,13 @@ export default function TrashRetention() {
|
||||
}}
|
||||
size="sm"
|
||||
style={{ flex: 1 }}
|
||||
disabled={!hasAccess}
|
||||
disabled={!hasRetention}
|
||||
/>
|
||||
<Button
|
||||
size="sm"
|
||||
onClick={handleSave}
|
||||
loading={saving}
|
||||
disabled={!hasAccess || !isDirty}
|
||||
disabled={!hasRetention || !isDirty}
|
||||
>
|
||||
{t("Save")}
|
||||
</Button>
|
||||
|
||||
@@ -18,7 +18,9 @@ import { Feature } from "@/ee/features";
|
||||
export default function Security() {
|
||||
const { t } = useTranslation();
|
||||
const { isAdmin } = useUserRole();
|
||||
const hasSecurityAccess = useHasFeature(Feature.SECURITY_SETTINGS);
|
||||
const hasCustomSso = useHasFeature(Feature.SSO_CUSTOM);
|
||||
const hasRetention = useHasFeature(Feature.RETENTION);
|
||||
const hasSharingControls = useHasFeature(Feature.SHARING_CONTROLS);
|
||||
|
||||
if (!isAdmin) {
|
||||
return null;
|
||||
@@ -35,39 +37,27 @@ export default function Security() {
|
||||
|
||||
<Divider my="lg" />
|
||||
|
||||
{(!isCloud() || hasSecurityAccess) && (
|
||||
<>
|
||||
<DisablePublicSharing />
|
||||
<Divider my="lg" />
|
||||
</>
|
||||
)}
|
||||
<DisablePublicSharing />
|
||||
<Divider my="lg" />
|
||||
|
||||
{!isCloud() && (
|
||||
<>
|
||||
<TrashRetention />
|
||||
<Divider my="lg" />
|
||||
</>
|
||||
)}
|
||||
<TrashRetention />
|
||||
<Divider my="lg" />
|
||||
|
||||
<Title order={4} my="lg">
|
||||
Single sign-on (SSO)
|
||||
</Title>
|
||||
|
||||
{hasSecurityAccess && (
|
||||
<>
|
||||
<EnforceSso />
|
||||
<Divider my="lg" />
|
||||
</>
|
||||
)}
|
||||
<EnforceSso />
|
||||
<Divider my="lg" />
|
||||
|
||||
{(isCloud() || hasSecurityAccess) && (
|
||||
{(isCloud() || hasCustomSso) && (
|
||||
<>
|
||||
<AllowedDomains />
|
||||
<Divider my="lg" />
|
||||
</>
|
||||
)}
|
||||
|
||||
{hasSecurityAccess && (
|
||||
{hasCustomSso && (
|
||||
<>
|
||||
<CreateSsoProvider />
|
||||
<Divider size={0} my="lg" />
|
||||
|
||||
@@ -19,8 +19,6 @@ import {
|
||||
ResponsiveSettingsRow,
|
||||
} from "@/components/ui/responsive-settings-row.tsx";
|
||||
import SpacePublicSharingToggle from "@/ee/security/components/space-public-sharing-toggle.tsx";
|
||||
import { useHasFeature } from "@/ee/hooks/use-feature";
|
||||
import { Feature } from "@/ee/features";
|
||||
|
||||
interface SpaceDetailsProps {
|
||||
spaceId: string;
|
||||
@@ -29,8 +27,7 @@ interface SpaceDetailsProps {
|
||||
export default function SpaceDetails({ spaceId, readOnly }: SpaceDetailsProps) {
|
||||
const { t } = useTranslation();
|
||||
const { data: space, isLoading, refetch } = useSpaceQuery(spaceId);
|
||||
const hasEnterpriseAccess = useHasFeature(Feature.SECURITY_SETTINGS);
|
||||
const showSharingToggle = !readOnly && hasEnterpriseAccess;
|
||||
const showSharingToggle = !readOnly;
|
||||
const [exportOpened, { open: openExportModal, close: closeExportModal }] =
|
||||
useDisclosure(false);
|
||||
const [isIconUploading, setIsIconUploading] = useState(false);
|
||||
|
||||
+1
-1
Submodule apps/server/src/ee updated: 44300c3d8e...8b21c6e32e
Reference in New Issue
Block a user