snapshot of https://github.com/RocketChat/Rocket.Chat.git (develop, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s
This commit is contained in:
129
apps/meteor/client/views/admin/settings/groups/LDAPGroupPage.tsx
Normal file
129
apps/meteor/client/views/admin/settings/groups/LDAPGroupPage.tsx
Normal file
@@ -0,0 +1,129 @@
|
||||
import type { ISetting } from '@rocket.chat/core-typings';
|
||||
import { Button, Box, TextInput, Field, FieldLabel, FieldRow } from '@rocket.chat/fuselage';
|
||||
import { useStableCallback } from '@rocket.chat/fuselage-hooks';
|
||||
import { GenericModal } from '@rocket.chat/ui-client';
|
||||
import { useSetModal, useToastMessageDispatch, useSetting, useEndpoint } from '@rocket.chat/ui-contexts';
|
||||
import type { ChangeEvent } from 'react';
|
||||
import { memo, useMemo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import BaseGroupPage from './BaseGroupPage';
|
||||
import { useExternalLink } from '../../../../hooks/useExternalLink';
|
||||
import { useLdapSync } from '../../../../hooks/useLdapSync';
|
||||
import { links } from '../../../../lib/links';
|
||||
import { useEditableSettings } from '../../EditableSettingsContext';
|
||||
|
||||
export type LDAPGroupPageProps = ISetting & {
|
||||
onClickBack?: () => void;
|
||||
};
|
||||
|
||||
function LDAPGroupPage({ _id, i18nLabel, onClickBack, ...group }: LDAPGroupPageProps) {
|
||||
const { t } = useTranslation();
|
||||
const dispatchToastMessage = useToastMessageDispatch();
|
||||
const testConnection = useEndpoint('POST', '/v1/ldap.testConnection');
|
||||
const testSearch = useEndpoint('POST', '/v1/ldap.testSearch');
|
||||
const ldapEnabled = useSetting('LDAP_Enable');
|
||||
const setModal = useSetModal();
|
||||
const closeModal = useStableCallback(() => setModal());
|
||||
const handleSyncNow = useLdapSync();
|
||||
|
||||
const handleLinkClick = useExternalLink();
|
||||
|
||||
const editableSettings = useEditableSettings(
|
||||
useMemo(
|
||||
() => ({
|
||||
group: _id,
|
||||
}),
|
||||
[_id],
|
||||
),
|
||||
);
|
||||
|
||||
const changed = useMemo(() => editableSettings.some(({ changed }) => changed), [editableSettings]);
|
||||
|
||||
const handleTestConnectionButtonClick = async (): Promise<void> => {
|
||||
try {
|
||||
const { message } = await testConnection();
|
||||
dispatchToastMessage({ type: 'success', message: t(message as Parameters<typeof t>[0]) });
|
||||
} catch (error) {
|
||||
error instanceof Error && dispatchToastMessage({ type: 'error', message: error });
|
||||
}
|
||||
};
|
||||
|
||||
const handleSearchTestButtonClick = async (): Promise<void> => {
|
||||
try {
|
||||
await testConnection();
|
||||
let username = '';
|
||||
const handleChangeUsername = (event: ChangeEvent<HTMLInputElement>): void => {
|
||||
username = event.currentTarget.value;
|
||||
};
|
||||
|
||||
const confirmSearch = async (): Promise<void> => {
|
||||
try {
|
||||
const { message } = await testSearch({ username });
|
||||
dispatchToastMessage({ type: 'success', message: t(message as Parameters<typeof t>[0]) });
|
||||
} catch (error) {
|
||||
error instanceof Error && dispatchToastMessage({ type: 'error', message: error });
|
||||
}
|
||||
};
|
||||
|
||||
setModal(
|
||||
<GenericModal
|
||||
wrapperFunction={(props) => (
|
||||
<Box
|
||||
is='form'
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
confirmSearch();
|
||||
}}
|
||||
{...props}
|
||||
/>
|
||||
)}
|
||||
variant='info'
|
||||
confirmText={t('Search')}
|
||||
cancelText={t('Cancel')}
|
||||
title={t('Test_LDAP_Search')}
|
||||
onClose={closeModal}
|
||||
>
|
||||
<Field>
|
||||
<Box display='flex'>
|
||||
<FieldLabel>{t('LDAP_Username_To_Search')}</FieldLabel>
|
||||
</Box>
|
||||
|
||||
<FieldRow>
|
||||
<TextInput onChange={handleChangeUsername} />
|
||||
</FieldRow>
|
||||
</Field>
|
||||
</GenericModal>,
|
||||
);
|
||||
} catch (error) {
|
||||
error instanceof Error && dispatchToastMessage({ type: 'error', message: error });
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<BaseGroupPage
|
||||
_id={_id}
|
||||
i18nLabel={i18nLabel}
|
||||
onClickBack={onClickBack}
|
||||
{...group}
|
||||
headerButtons={
|
||||
<>
|
||||
<Button disabled={!ldapEnabled || changed} onClick={handleTestConnectionButtonClick}>
|
||||
{t('Test_Connection')}
|
||||
</Button>
|
||||
<Button disabled={!ldapEnabled || changed} onClick={handleSearchTestButtonClick}>
|
||||
{t('Test_LDAP_Search')}
|
||||
</Button>
|
||||
<Button disabled={!ldapEnabled || changed} onClick={handleSyncNow}>
|
||||
{t('LDAP_Sync_Now')}
|
||||
</Button>
|
||||
<Button role='link' onClick={() => handleLinkClick(links.go.ldapDocs)}>
|
||||
{t('LDAP_Documentation')}
|
||||
</Button>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default memo(LDAPGroupPage);
|
||||
Reference in New Issue
Block a user