File tree Expand file tree Collapse file tree 4 files changed +846
-111
lines changed
backend/src/entities/connection
shared-code/src/data-access-layer Expand file tree Collapse file tree 4 files changed +846
-111
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,7 @@ import {
8383import { TokenValidationResult } from './use-cases/validate-connection-token.use.case.js' ;
8484import { isTestConnectionUtil } from './utils/is-test-connection-util.js' ;
8585import { 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
Original file line number Diff line number Diff line change @@ -3,7 +3,10 @@ import { getRepository } from 'typeorm';
33import AbstractUseCase from '../../../common/abstract-use.case.js' ;
44import { IGlobalDatabaseContext } from '../../../common/application/global-database-context.interface.js' ;
55import { 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' ;
710import { Messages } from '../../../exceptions/text/messages.js' ;
811import { processExceptionMessage } from '../../../exceptions/utils/process-exception-message.js' ;
912import { 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 ,
You can’t perform that action at this time.
0 commit comments