chore: migrate ldap endpoints to new API pattern
Merged
SM
7mo ago+73+73+01234567890123456789-43-43-01234567890123456789
Summary
Migrates the ldap.testConnection and ldap.testSearch POST endpoints from the legacy API.v1.addRoute() pattern to the new chained .post() API pattern.
Changes
- Replaced
addRoutecalls withAPI.v1.post()chained pattern - Added typed AJV response schemas for 200, 401, and 403 responses
- Replaced Meteor
check()with AJV validation:ldap.testSearchnow uses the existingisLdapTestSearchAJV validator from@rocket.chat/rest-typingsviavalidateParamsinstead ofcheck(this.bodyParams, Match.ObjectIncluding({...})) - Shared
messageResponseSchemafor both endpoints' response validation - Removed
meteor/checkimport dependency - Preserved all existing behavior: permission checks, LDAP enable checks, error logging
Motivation
Part of the ongoing effort to migrate REST API endpoints to the new chained API pattern that enables typed response validation and future OpenAPI spec generation. This PR additionally removes a Meteor check() dependency in favor of AJV validation.
Closes part of #38876
Summary by CodeRabbit
- Refactor
- LDAP test endpoints migrated to a new API pattern with stricter input validation.
- Standardized success payloads (message + success) and consistent error responses for predictable client behavior.
- Authentication and permission checks are now enforced for these endpoints.
- Search and connection test actions centrally handle errors while preserving visible success messages.
Task: ARCH-2007
[COMM-144]