Skip to content

Commit

Permalink
chore(sql-server): add checkSqlAuth extension point (#8517)
Browse files Browse the repository at this point in the history
  • Loading branch information
bsod90 authored Jul 25, 2024
1 parent 99b3c65 commit b823709
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/cubejs-api-gateway/src/sql-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,17 @@ export class SQLServer {
await execSql(this.sqlInterfaceInstance!, sqlQuery, stream, securityContext);
}

protected buildCheckSqlAuth(options: SQLServerOptions): CheckSQLAuthFn {
return (options.checkSqlAuth && this.wrapCheckSqlAuthFn(options.checkSqlAuth))
|| this.createDefaultCheckSqlAuthFn(options);
}

public async init(options: SQLServerOptions): Promise<void> {
if (this.sqlInterfaceInstance) {
throw new Error('Unable to start SQL interface two times');
}

const checkSqlAuth: CheckSQLAuthFn = (options.checkSqlAuth && this.wrapCheckSqlAuthFn(options.checkSqlAuth))
|| this.createDefaultCheckSqlAuthFn(options);
const checkSqlAuth: CheckSQLAuthFn = this.buildCheckSqlAuth(options);

const canSwitchSqlUser: CanSwitchSQLUserFn = options.canSwitchSqlUser
|| this.createDefaultCanSwitchSqlUserFn(options);
Expand Down

0 comments on commit b823709

Please sign in to comment.