Skip to content

Commit 40aa568

Browse files
Merge branch 'main' into fixes
2 parents f25e510 + b22bd2b commit 40aa568

File tree

4 files changed

+846
-111
lines changed

4 files changed

+846
-111
lines changed

backend/src/entities/connection/connection.controller.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ import {
8383
import { TokenValidationResult } from './use-cases/validate-connection-token.use.case.js';
8484
import { isTestConnectionUtil } from './utils/is-test-connection-util.js';
8585
import { SkipThrottle } from '@nestjs/throttler';
86+
import { isRedisConnectionUrl } from '@rocketadmin/shared-code/dist/src/data-access-layer/shared/create-data-access-object.js';
8687

8788
@UseInterceptors(SentryInterceptor)
8889
@Controller()
@@ -243,7 +244,11 @@ export class ConnectionController {
243244
@UserId() userId: string,
244245
@MasterPassword() masterPwd: string,
245246
): Promise<CreatedConnectionDTO> {
246-
if (!createConnectionDto.password && !isConnectionTypeAgent(createConnectionDto.type)) {
247+
if (
248+
!createConnectionDto.password &&
249+
!isConnectionTypeAgent(createConnectionDto.type) &&
250+
!isRedisConnectionUrl(createConnectionDto.host)
251+
) {
247252
throw new BadRequestException(Messages.PASSWORD_MISSING);
248253
}
249254
if (createConnectionDto.masterEncryption && !masterPwd) {
@@ -709,6 +714,10 @@ export class ConnectionController {
709714
return errors;
710715
}
711716

717+
if (isRedisConnectionUrl(connectionData.host)) {
718+
return errors;
719+
}
720+
712721
if (!connectionData.username && connectionData.type !== ConnectionTypesEnum.redis)
713722
errors.push(Messages.USERNAME_MISSING);
714723

backend/src/entities/connection/use-cases/test-connection.use.case.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ import { getRepository } from 'typeorm';
33
import AbstractUseCase from '../../../common/abstract-use.case.js';
44
import { IGlobalDatabaseContext } from '../../../common/application/global-database-context.interface.js';
55
import { BaseType } from '../../../common/data-injection.tokens.js';
6-
import { getDataAccessObject } from '@rocketadmin/shared-code/dist/src/data-access-layer/shared/create-data-access-object.js';
6+
import {
7+
getDataAccessObject,
8+
isRedisConnectionUrl,
9+
} from '@rocketadmin/shared-code/dist/src/data-access-layer/shared/create-data-access-object.js';
710
import { Messages } from '../../../exceptions/text/messages.js';
811
import { processExceptionMessage } from '../../../exceptions/utils/process-exception-message.js';
912
import { isConnectionTypeAgent, slackPostMessage } from '../../../helpers/index.js';
@@ -96,7 +99,8 @@ export class TestConnectionUseCase
9699
if (
97100
!connectionData.password &&
98101
(connectionData.host !== toUpdate.host || connectionData.port !== toUpdate.port) &&
99-
!isConnectionTypeAgent(connectionData.type)
102+
!isConnectionTypeAgent(connectionData.type) &&
103+
!isRedisConnectionUrl(connectionData.host)
100104
) {
101105
return {
102106
result: false,
@@ -125,7 +129,7 @@ export class TestConnectionUseCase
125129
};
126130
}
127131
} else {
128-
if (!connectionData.password) {
132+
if (!connectionData.password && !isConnectionTypeAgent(connectionData.type) && !isRedisConnectionUrl(connectionData.host)) {
129133
return {
130134
result: false,
131135
message: Messages.PASSWORD_MISSING,

0 commit comments

Comments
 (0)