From e8a1c99626c3d331a5e1dca35910b64509121a34 Mon Sep 17 00:00:00 2001 From: NFish Date: Mon, 12 Jan 2026 12:04:53 +0800 Subject: [PATCH] feat: add permission check before owner transfer workspace --- .../members-page/operation/transfer-ownership.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/web/app/components/header/account-setting/members-page/operation/transfer-ownership.tsx b/web/app/components/header/account-setting/members-page/operation/transfer-ownership.tsx index 815c86abc7..6903a85f2e 100644 --- a/web/app/components/header/account-setting/members-page/operation/transfer-ownership.tsx +++ b/web/app/components/header/account-setting/members-page/operation/transfer-ownership.tsx @@ -5,6 +5,9 @@ import { } from '@remixicon/react' import { Fragment } from 'react' import { useTranslation } from 'react-i18next' +import Loading from '@/app/components/base/loading' +import { useGlobalPublicStore } from '@/context/global-public-context' +import { useWorkspacePermissions } from '@/service/use-workspace' import { cn } from '@/utils/classnames' type Props = { @@ -13,6 +16,16 @@ type Props = { const TransferOwnership = ({ onOperate }: Props) => { const { t } = useTranslation() + const systemFeatures = useGlobalPublicStore(s => s.systemFeatures) + const { data: workspacePermissions, isFetching: isFetchingWorkspacePermissions } = useWorkspacePermissions(systemFeatures.branding.enabled) + if (systemFeatures.branding.enabled) { + if (isFetchingWorkspacePermissions) { + return + } + if (!workspacePermissions || workspacePermissions.allow_owner_transfer !== true) { + return {t('members.owner', { ns: 'common' })} + } + } return (