diff --git a/web/app/components/plugins/plugin-auth/__tests__/plugin-auth.spec.tsx b/web/app/components/plugins/plugin-auth/__tests__/plugin-auth.spec.tsx index 1423f3896d5..c7175a1ba76 100644 --- a/web/app/components/plugins/plugin-auth/__tests__/plugin-auth.spec.tsx +++ b/web/app/components/plugins/plugin-auth/__tests__/plugin-auth.spec.tsx @@ -68,6 +68,7 @@ describe('PluginAuth', () => { render() expect(screen.getByRole('button', { name: 'plugin.auth.useApiAuth' })).toBeEnabled() + expect(screen.queryByText('plugin.auth.permissionHint.title')).not.toBeInTheDocument() expect(screen.queryByTestId('authorized')).not.toBeInTheDocument() }) diff --git a/web/app/components/plugins/plugin-auth/plugin-auth.tsx b/web/app/components/plugins/plugin-auth/plugin-auth.tsx index 66441fa2d33..d84595809aa 100644 --- a/web/app/components/plugins/plugin-auth/plugin-auth.tsx +++ b/web/app/components/plugins/plugin-auth/plugin-auth.tsx @@ -4,6 +4,7 @@ import { memo } from 'react' import { useTranslation } from 'react-i18next' import { ACCOUNT_SETTING_TAB } from '@/app/components/header/account-setting/constants' import { useModalContext } from '@/context/modal-context' +import { useCredentialPermissions } from '@/hooks/use-credential-permissions' import Authorize from './authorize' import Authorized from './authorized' import { usePluginAuth } from './hooks/use-plugin-auth' @@ -17,6 +18,7 @@ type PluginAuthProps = { const PluginAuth = ({ pluginPayload, children, className }: PluginAuthProps) => { const { t } = useTranslation() const { setShowAccountSettingModal } = useModalContext() + const { canCreateCredential } = useCredentialPermissions() const { isAuthorized, canOAuth, @@ -27,6 +29,7 @@ const PluginAuth = ({ pluginPayload, children, className }: PluginAuthProps) => } = usePluginAuth(pluginPayload, !!pluginPayload.provider) const showPermissionHint = !isAuthorized && + !canCreateCredential && !notAllowCustomCredential && pluginPayload.category === AuthCategory.tool && (canOAuth || canApiKey)