From a9a0fa5d08532bb0ade0f2bff8c7ea537a88a3fa Mon Sep 17 00:00:00 2001 From: Maxim Leonovich Date: Wed, 11 Dec 2024 08:35:03 -0800 Subject: [PATCH] fix(api-gateway): allow switch sql user when the new user is the same --- packages/cubejs-api-gateway/src/sql-server.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/cubejs-api-gateway/src/sql-server.ts b/packages/cubejs-api-gateway/src/sql-server.ts index 5ab0318b29f55..32e7d37e1e19c 100644 --- a/packages/cubejs-api-gateway/src/sql-server.ts +++ b/packages/cubejs-api-gateway/src/sql-server.ts @@ -301,7 +301,11 @@ export class SQLServer { protected createDefaultCanSwitchSqlUserFn(options: SQLServerOptions): CanSwitchSQLUserFn { const superUser = options.sqlSuperUser || getEnv('sqlSuperUser'); - return async (current: string | null, _user: string) => { + return async (current: string | null, newUser: string) => { + if (current === newUser) { + return true; + } + if (superUser) { return current === superUser; }