dbgate-api-premium 6.6.0 → 6.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/package.json +6 -6
  2. package/src/auth/authProvider.js +14 -2
  3. package/src/auth/storageAuthProvider.js +89 -22
  4. package/src/controllers/archive.js +1 -1
  5. package/src/controllers/auth.js +3 -2
  6. package/src/controllers/cloud.js +1 -1
  7. package/src/controllers/config.js +8 -5
  8. package/src/controllers/connections.js +12 -11
  9. package/src/controllers/databaseConnections.js +148 -83
  10. package/src/controllers/files.js +49 -19
  11. package/src/controllers/plugins.js +7 -4
  12. package/src/controllers/runners.js +10 -6
  13. package/src/controllers/scheduler.js +4 -3
  14. package/src/controllers/serverConnections.js +69 -14
  15. package/src/controllers/sessions.js +8 -5
  16. package/src/controllers/storage.js +81 -51
  17. package/src/controllers/storageDb.js +118 -4
  18. package/src/controllers/uploads.js +2 -2
  19. package/src/currentVersion.js +2 -2
  20. package/src/index.js +36 -5
  21. package/src/main.js +59 -20
  22. package/src/proc/databaseConnectionProcess.js +45 -13
  23. package/src/proc/serverConnectionProcess.js +32 -6
  24. package/src/proc/sessionProcess.js +2 -2
  25. package/src/proc/sshForwardProcess.js +1 -1
  26. package/src/shell/archiveWriter.js +1 -1
  27. package/src/shell/copyStream.js +1 -1
  28. package/src/shell/executeQuery.js +3 -3
  29. package/src/shell/importDatabase.js +3 -3
  30. package/src/shell/jsonLinesReader.js +1 -1
  31. package/src/shell/jsonLinesWriter.js +1 -1
  32. package/src/shell/jsonReader.js +1 -1
  33. package/src/shell/jsonWriter.js +1 -1
  34. package/src/shell/loadDatabase.js +2 -2
  35. package/src/shell/modifyJsonLinesReader.js +1 -1
  36. package/src/shell/queryReader.js +1 -1
  37. package/src/shell/requirePlugin.js +6 -1
  38. package/src/shell/runScript.js +1 -1
  39. package/src/shell/sqlDataWriter.js +1 -1
  40. package/src/shell/tableReader.js +3 -3
  41. package/src/shell/tableWriter.js +1 -1
  42. package/src/shell/unzipDirectory.js +4 -4
  43. package/src/shell/zipDirectory.js +3 -3
  44. package/src/shell/zipJsonLinesData.js +3 -3
  45. package/src/storageModel.js +726 -105
  46. package/src/utility/DatastoreProxy.js +3 -3
  47. package/src/utility/JsonLinesDatastore.js +4 -2
  48. package/src/utility/appLogStore.js +119 -0
  49. package/src/utility/auditlog.js +1 -1
  50. package/src/utility/authProxy.js +4 -4
  51. package/src/utility/checkLicense.js +10 -4
  52. package/src/utility/childProcessChecker.js +1 -1
  53. package/src/utility/cloudIntf.js +5 -5
  54. package/src/utility/cloudUpgrade.js +4 -4
  55. package/src/utility/connectUtility.js +1 -1
  56. package/src/utility/directories.js +2 -2
  57. package/src/utility/extractSingleFileFromZip.js +3 -3
  58. package/src/utility/hasPermission.js +286 -71
  59. package/src/utility/loadModelTransform.js +1 -1
  60. package/src/utility/sshTunnel.js +7 -7
  61. package/src/utility/sshTunnelProxy.js +1 -1
  62. package/src/utility/useController.js +3 -3
@@ -29,7 +29,7 @@ const generateDeploySql = require('../shell/generateDeploySql');
29
29
  const { createTwoFilesPatch } = require('diff');
30
30
  const diff2htmlPage = require('../utility/diff2htmlPage');
31
31
  const processArgs = require('../utility/processArgs');
32
- const { testConnectionPermission } = require('../utility/hasPermission');
32
+ const { testConnectionPermission, hasPermission, loadPermissionsFromRequest, loadTablePermissionsFromRequest, getTablePermissionRole, loadDatabasePermissionsFromRequest, getDatabasePermissionRole, getTablePermissionRoleLevelIndex, testDatabaseRolePermission } = require('../utility/hasPermission');
33
33
  const { MissingCredentialsError } = require('../utility/exceptions');
34
34
  const pipeForkLogs = require('../utility/pipeForkLogs');
35
35
  const crypto = require('crypto');
@@ -76,7 +76,7 @@ module.exports = {
76
76
 
77
77
  handle_error(conid, database, props) {
78
78
  const { error } = props;
79
- logger.error(`Error in database connection ${conid}, database ${database}: ${error}`);
79
+ logger.error(`DBGM-00102 Error in database connection ${conid}, database ${database}: ${error}`);
80
80
  if (props?.msgid) {
81
81
  const [resolve, reject] = this.requests[props?.msgid];
82
82
  reject(error);
@@ -100,7 +100,7 @@ module.exports = {
100
100
  socket.emitChanged(`database-status-changed`, { conid, database });
101
101
  },
102
102
 
103
- handle_ping() {},
103
+ handle_ping() { },
104
104
 
105
105
  // session event handlers
106
106
 
@@ -144,7 +144,7 @@ module.exports = {
144
144
  handle_copyStreamError(conid, database, { copyStreamError }) {
145
145
  const { progressName } = copyStreamError;
146
146
  const { runid } = progressName;
147
- logger.error(`Error in database connection ${conid}, database ${database}: ${copyStreamError}`);
147
+ logger.error(`DBGM-00103 Error in database connection ${conid}, database ${database}: ${copyStreamError}`);
148
148
  socket.emit(`runner-done-${runid}`);
149
149
  },
150
150
 
@@ -193,7 +193,7 @@ module.exports = {
193
193
  if (newOpened.disconnected) return;
194
194
  const funcName = `handle_${msgtype}`;
195
195
  if (!this[funcName]) {
196
- logger.error(`Unknown message type ${msgtype} from subprocess databaseConnectionProcess`);
196
+ logger.error(`DBGM-00104 Unknown message type ${msgtype} from subprocess databaseConnectionProcess`);
197
197
  return;
198
198
  }
199
199
 
@@ -204,7 +204,7 @@ module.exports = {
204
204
  this.close(conid, database, false);
205
205
  });
206
206
  subprocess.on('error', err => {
207
- logger.error(extractErrorLogData(err), 'Error in database connection subprocess');
207
+ logger.error(extractErrorLogData(err), 'DBGM-00114 Error in database connection subprocess');
208
208
  if (newOpened.disconnected) return;
209
209
  this.close(conid, database, false);
210
210
  });
@@ -226,7 +226,7 @@ module.exports = {
226
226
  try {
227
227
  conn.subprocess.send({ msgid, ...message });
228
228
  } catch (err) {
229
- logger.error(extractErrorLogData(err), 'Error sending request do process');
229
+ logger.error(extractErrorLogData(err), 'DBGM-00115 Error sending request do process');
230
230
  this.close(conn.conid, conn.database);
231
231
  }
232
232
  });
@@ -235,8 +235,8 @@ module.exports = {
235
235
 
236
236
  queryData_meta: true,
237
237
  async queryData({ conid, database, sql }, req) {
238
- testConnectionPermission(conid, req);
239
- logger.info({ conid, database, sql }, 'Processing query');
238
+ await testConnectionPermission(conid, req);
239
+ logger.info({ conid, database, sql }, 'DBGM-00007 Processing query');
240
240
  const opened = await this.ensureOpened(conid, database);
241
241
  // if (opened && opened.status && opened.status.name == 'error') {
242
242
  // return opened.status;
@@ -247,7 +247,7 @@ module.exports = {
247
247
 
248
248
  sqlSelect_meta: true,
249
249
  async sqlSelect({ conid, database, select, auditLogSessionGroup }, req) {
250
- testConnectionPermission(conid, req);
250
+ await testConnectionPermission(conid, req);
251
251
  const opened = await this.ensureOpened(conid, database);
252
252
  const res = await this.sendRequest(
253
253
  opened,
@@ -256,24 +256,23 @@ module.exports = {
256
256
  auditLogger:
257
257
  auditLogSessionGroup && select?.from?.name?.pureName
258
258
  ? response => {
259
- sendToAuditLog(req, {
260
- category: 'dbop',
261
- component: 'DatabaseConnectionsController',
262
- event: 'sql.select',
263
- action: 'select',
264
- severity: 'info',
265
- conid,
266
- database,
267
- schemaName: select?.from?.name?.schemaName,
268
- pureName: select?.from?.name?.pureName,
269
- sumint1: response?.rows?.length,
270
- sessionParam: `${conid}::${database}::${select?.from?.name?.schemaName || '0'}::${
271
- select?.from?.name?.pureName
259
+ sendToAuditLog(req, {
260
+ category: 'dbop',
261
+ component: 'DatabaseConnectionsController',
262
+ event: 'sql.select',
263
+ action: 'select',
264
+ severity: 'info',
265
+ conid,
266
+ database,
267
+ schemaName: select?.from?.name?.schemaName,
268
+ pureName: select?.from?.name?.pureName,
269
+ sumint1: response?.rows?.length,
270
+ sessionParam: `${conid}::${database}::${select?.from?.name?.schemaName || '0'}::${select?.from?.name?.pureName
272
271
  }`,
273
- sessionGroup: auditLogSessionGroup,
274
- message: `Loaded table data from ${select?.from?.name?.pureName}`,
275
- });
276
- }
272
+ sessionGroup: auditLogSessionGroup,
273
+ message: `Loaded table data from ${select?.from?.name?.pureName}`,
274
+ });
275
+ }
277
276
  : null,
278
277
  }
279
278
  );
@@ -282,8 +281,10 @@ module.exports = {
282
281
 
283
282
  runScript_meta: true,
284
283
  async runScript({ conid, database, sql, useTransaction, logMessage }, req) {
285
- testConnectionPermission(conid, req);
286
- logger.info({ conid, database, sql }, 'Processing script');
284
+ const loadedPermissions = await loadPermissionsFromRequest(req);
285
+ await testConnectionPermission(conid, req, loadedPermissions);
286
+ await testDatabaseRolePermission(conid, database, 'run_script', req);
287
+ logger.info({ conid, database, sql }, 'DBGM-00008 Processing script');
287
288
  const opened = await this.ensureOpened(conid, database);
288
289
  sendToAuditLog(req, {
289
290
  category: 'dbop',
@@ -303,8 +304,8 @@ module.exports = {
303
304
 
304
305
  runOperation_meta: true,
305
306
  async runOperation({ conid, database, operation, useTransaction }, req) {
306
- testConnectionPermission(conid, req);
307
- logger.info({ conid, database, operation }, 'Processing operation');
307
+ await testConnectionPermission(conid, req);
308
+ logger.info({ conid, database, operation }, 'DBGM-00009 Processing operation');
308
309
 
309
310
  sendToAuditLog(req, {
310
311
  category: 'dbop',
@@ -325,7 +326,7 @@ module.exports = {
325
326
 
326
327
  collectionData_meta: true,
327
328
  async collectionData({ conid, database, options, auditLogSessionGroup }, req) {
328
- testConnectionPermission(conid, req);
329
+ await testConnectionPermission(conid, req);
329
330
  const opened = await this.ensureOpened(conid, database);
330
331
  const res = await this.sendRequest(
331
332
  opened,
@@ -334,21 +335,21 @@ module.exports = {
334
335
  auditLogger:
335
336
  auditLogSessionGroup && options?.pureName
336
337
  ? response => {
337
- sendToAuditLog(req, {
338
- category: 'dbop',
339
- component: 'DatabaseConnectionsController',
340
- event: 'nosql.collectionData',
341
- action: 'select',
342
- severity: 'info',
343
- conid,
344
- database,
345
- pureName: options?.pureName,
346
- sumint1: response?.result?.rows?.length,
347
- sessionParam: `${conid}::${database}::${options?.pureName}`,
348
- sessionGroup: auditLogSessionGroup,
349
- message: `Loaded collection data ${options?.pureName}`,
350
- });
351
- }
338
+ sendToAuditLog(req, {
339
+ category: 'dbop',
340
+ component: 'DatabaseConnectionsController',
341
+ event: 'nosql.collectionData',
342
+ action: 'select',
343
+ severity: 'info',
344
+ conid,
345
+ database,
346
+ pureName: options?.pureName,
347
+ sumint1: response?.result?.rows?.length,
348
+ sessionParam: `${conid}::${database}::${options?.pureName}`,
349
+ sessionGroup: auditLogSessionGroup,
350
+ message: `Loaded collection data ${options?.pureName}`,
351
+ });
352
+ }
352
353
  : null,
353
354
  }
354
355
  );
@@ -356,7 +357,7 @@ module.exports = {
356
357
  },
357
358
 
358
359
  async loadDataCore(msgtype, { conid, database, ...args }, req) {
359
- testConnectionPermission(conid, req);
360
+ await testConnectionPermission(conid, req);
360
361
  const opened = await this.ensureOpened(conid, database);
361
362
  const res = await this.sendRequest(opened, { msgtype, ...args });
362
363
  if (res.errorMessage) {
@@ -371,7 +372,7 @@ module.exports = {
371
372
 
372
373
  schemaList_meta: true,
373
374
  async schemaList({ conid, database }, req) {
374
- testConnectionPermission(conid, req);
375
+ await testConnectionPermission(conid, req);
375
376
  return this.loadDataCore('schemaList', { conid, database });
376
377
  },
377
378
 
@@ -383,43 +384,43 @@ module.exports = {
383
384
 
384
385
  loadKeys_meta: true,
385
386
  async loadKeys({ conid, database, root, filter, limit }, req) {
386
- testConnectionPermission(conid, req);
387
+ await testConnectionPermission(conid, req);
387
388
  return this.loadDataCore('loadKeys', { conid, database, root, filter, limit });
388
389
  },
389
390
 
390
391
  scanKeys_meta: true,
391
392
  async scanKeys({ conid, database, root, pattern, cursor, count }, req) {
392
- testConnectionPermission(conid, req);
393
+ await testConnectionPermission(conid, req);
393
394
  return this.loadDataCore('scanKeys', { conid, database, root, pattern, cursor, count });
394
395
  },
395
396
 
396
397
  exportKeys_meta: true,
397
398
  async exportKeys({ conid, database, options }, req) {
398
- testConnectionPermission(conid, req);
399
+ await testConnectionPermission(conid, req);
399
400
  return this.loadDataCore('exportKeys', { conid, database, options });
400
401
  },
401
402
 
402
403
  loadKeyInfo_meta: true,
403
404
  async loadKeyInfo({ conid, database, key }, req) {
404
- testConnectionPermission(conid, req);
405
+ await testConnectionPermission(conid, req);
405
406
  return this.loadDataCore('loadKeyInfo', { conid, database, key });
406
407
  },
407
408
 
408
409
  loadKeyTableRange_meta: true,
409
410
  async loadKeyTableRange({ conid, database, key, cursor, count }, req) {
410
- testConnectionPermission(conid, req);
411
+ await testConnectionPermission(conid, req);
411
412
  return this.loadDataCore('loadKeyTableRange', { conid, database, key, cursor, count });
412
413
  },
413
414
 
414
415
  loadFieldValues_meta: true,
415
416
  async loadFieldValues({ conid, database, schemaName, pureName, field, search, dataType }, req) {
416
- testConnectionPermission(conid, req);
417
+ await testConnectionPermission(conid, req);
417
418
  return this.loadDataCore('loadFieldValues', { conid, database, schemaName, pureName, field, search, dataType });
418
419
  },
419
420
 
420
421
  callMethod_meta: true,
421
422
  async callMethod({ conid, database, method, args }, req) {
422
- testConnectionPermission(conid, req);
423
+ await testConnectionPermission(conid, req);
423
424
  return this.loadDataCore('callMethod', { conid, database, method, args });
424
425
 
425
426
  // const opened = await this.ensureOpened(conid, database);
@@ -432,7 +433,8 @@ module.exports = {
432
433
 
433
434
  updateCollection_meta: true,
434
435
  async updateCollection({ conid, database, changeSet }, req) {
435
- testConnectionPermission(conid, req);
436
+ await testConnectionPermission(conid, req);
437
+
436
438
  const opened = await this.ensureOpened(conid, database);
437
439
  const res = await this.sendRequest(opened, { msgtype: 'updateCollection', changeSet });
438
440
  if (res.errorMessage) {
@@ -443,6 +445,36 @@ module.exports = {
443
445
  return res.result || null;
444
446
  },
445
447
 
448
+ saveTableData_meta: true,
449
+ async saveTableData({ conid, database, changeSet }, req) {
450
+ await testConnectionPermission(conid, req);
451
+
452
+ const databasePermissions = await loadDatabasePermissionsFromRequest(req);
453
+ const tablePermissions = await loadTablePermissionsFromRequest(req);
454
+ const fieldsAndRoles = [
455
+ [changeSet.inserts, 'create_update_delete'],
456
+ [changeSet.deletes, 'create_update_delete'],
457
+ [changeSet.updates, 'update_only'],
458
+ ]
459
+ for (const [operations, requiredRole] of fieldsAndRoles) {
460
+ for (const operation of operations) {
461
+ const role = getTablePermissionRole(conid, database, 'tables', operation.schemaName, operation.pureName, tablePermissions, databasePermissions);
462
+ if (getTablePermissionRoleLevelIndex(role) < getTablePermissionRoleLevelIndex(requiredRole)) {
463
+ throw new Error('DBGM-00262 Permission not granted');
464
+ }
465
+ }
466
+ }
467
+
468
+ const opened = await this.ensureOpened(conid, database);
469
+ const res = await this.sendRequest(opened, { msgtype: 'saveTableData', changeSet });
470
+ if (res.errorMessage) {
471
+ return {
472
+ errorMessage: res.errorMessage,
473
+ };
474
+ }
475
+ return res.result || null;
476
+ },
477
+
446
478
  status_meta: true,
447
479
  async status({ conid, database }, req) {
448
480
  if (!conid) {
@@ -451,7 +483,7 @@ module.exports = {
451
483
  message: 'No connection',
452
484
  };
453
485
  }
454
- testConnectionPermission(conid, req);
486
+ await testConnectionPermission(conid, req);
455
487
  const existing = this.opened.find(x => x.conid == conid && x.database == database);
456
488
  if (existing) {
457
489
  return {
@@ -474,14 +506,14 @@ module.exports = {
474
506
 
475
507
  ping_meta: true,
476
508
  async ping({ conid, database }, req) {
477
- testConnectionPermission(conid, req);
509
+ await testConnectionPermission(conid, req);
478
510
  let existing = this.opened.find(x => x.conid == conid && x.database == database);
479
511
 
480
512
  if (existing) {
481
513
  try {
482
514
  existing.subprocess.send({ msgtype: 'ping' });
483
515
  } catch (err) {
484
- logger.error(extractErrorLogData(err), 'Error pinging DB connection');
516
+ logger.error(extractErrorLogData(err), 'DBGM-00116 Error pinging DB connection');
485
517
  this.close(conid, database);
486
518
 
487
519
  return {
@@ -502,7 +534,7 @@ module.exports = {
502
534
 
503
535
  refresh_meta: true,
504
536
  async refresh({ conid, database, keepOpen }, req) {
505
- testConnectionPermission(conid, req);
537
+ await testConnectionPermission(conid, req);
506
538
  if (!keepOpen) this.close(conid, database);
507
539
 
508
540
  await this.ensureOpened(conid, database);
@@ -516,7 +548,7 @@ module.exports = {
516
548
  return { status: 'ok' };
517
549
  }
518
550
 
519
- testConnectionPermission(conid, req);
551
+ await testConnectionPermission(conid, req);
520
552
  const conn = await this.ensureOpened(conid, database);
521
553
  conn.subprocess.send({ msgtype: 'syncModel', isFullRefresh });
522
554
  return { status: 'ok' };
@@ -530,7 +562,7 @@ module.exports = {
530
562
  try {
531
563
  existing.subprocess.kill();
532
564
  } catch (err) {
533
- logger.error(extractErrorLogData(err), 'Error killing subprocess');
565
+ logger.error(extractErrorLogData(err), 'DBGM-00117 Error killing subprocess');
534
566
  }
535
567
  }
536
568
  this.opened = this.opened.filter(x => x.conid != conid || x.database != database);
@@ -553,7 +585,7 @@ module.exports = {
553
585
 
554
586
  disconnect_meta: true,
555
587
  async disconnect({ conid, database }, req) {
556
- testConnectionPermission(conid, req);
588
+ await testConnectionPermission(conid, req);
557
589
  await this.close(conid, database, true);
558
590
  return { status: 'ok' };
559
591
  },
@@ -563,8 +595,9 @@ module.exports = {
563
595
  if (!conid || !database) {
564
596
  return {};
565
597
  }
598
+ const loadedPermissions = await loadPermissionsFromRequest(req);
566
599
 
567
- testConnectionPermission(conid, req);
600
+ await testConnectionPermission(conid, req, loadedPermissions);
568
601
  if (conid == '__model') {
569
602
  const model = await importDbModel(database);
570
603
  const trans = await loadModelTransform(modelTransFile);
@@ -586,6 +619,38 @@ module.exports = {
586
619
  message: `Loaded database structure for ${database}`,
587
620
  });
588
621
 
622
+ if (!hasPermission(`all-tables`, loadedPermissions)) {
623
+ // filter databases by permissions
624
+ const tablePermissions = await loadTablePermissionsFromRequest(req);
625
+ const databasePermissions = await loadDatabasePermissionsFromRequest(req);
626
+ const databasePermissionRole = getDatabasePermissionRole(conid, database, databasePermissions);
627
+
628
+ function applyTablePermissionRole(list, objectTypeField) {
629
+ const res = [];
630
+ for (const item of list ?? []) {
631
+ const tablePermissionRole = getTablePermissionRole(conid, database, objectTypeField, item.schemaName, item.pureName, tablePermissions, databasePermissionRole);
632
+ if (tablePermissionRole != 'deny') {
633
+ res.push({
634
+ ...item,
635
+ tablePermissionRole,
636
+ });
637
+ }
638
+ }
639
+ return res;
640
+ }
641
+
642
+ const res = {
643
+ ...opened.structure,
644
+ tables: applyTablePermissionRole(opened.structure.tables, 'tables'),
645
+ views: applyTablePermissionRole(opened.structure.views, 'views'),
646
+ procedures: applyTablePermissionRole(opened.structure.procedures, 'procedures'),
647
+ functions: applyTablePermissionRole(opened.structure.functions, 'functions'),
648
+ triggers: applyTablePermissionRole(opened.structure.triggers, 'triggers'),
649
+ collections: applyTablePermissionRole(opened.structure.collections, 'collections'),
650
+ }
651
+ return res;
652
+ }
653
+
589
654
  return opened.structure;
590
655
  // const existing = this.opened.find((x) => x.conid == conid && x.database == database);
591
656
  // if (existing) return existing.status;
@@ -600,7 +665,7 @@ module.exports = {
600
665
  if (!conid) {
601
666
  return null;
602
667
  }
603
- testConnectionPermission(conid, req);
668
+ await testConnectionPermission(conid, req);
604
669
  if (!conid) return null;
605
670
  const opened = await this.ensureOpened(conid, database);
606
671
  return opened.serverVersion || null;
@@ -608,7 +673,7 @@ module.exports = {
608
673
 
609
674
  sqlPreview_meta: true,
610
675
  async sqlPreview({ conid, database, objects, options }, req) {
611
- testConnectionPermission(conid, req);
676
+ await testConnectionPermission(conid, req);
612
677
  // wait for structure
613
678
  await this.structure({ conid, database });
614
679
 
@@ -619,7 +684,7 @@ module.exports = {
619
684
 
620
685
  exportModel_meta: true,
621
686
  async exportModel({ conid, database, outputFolder, schema }, req) {
622
- testConnectionPermission(conid, req);
687
+ await testConnectionPermission(conid, req);
623
688
 
624
689
  const realFolder = outputFolder.startsWith('archive:')
625
690
  ? resolveArchiveFolder(outputFolder.substring('archive:'.length))
@@ -637,7 +702,7 @@ module.exports = {
637
702
 
638
703
  exportModelSql_meta: true,
639
704
  async exportModelSql({ conid, database, outputFolder, outputFile, schema }, req) {
640
- testConnectionPermission(conid, req);
705
+ await testConnectionPermission(conid, req);
641
706
 
642
707
  const connection = await connections.getCore({ conid });
643
708
  const driver = requireEngineDriver(connection);
@@ -651,7 +716,7 @@ module.exports = {
651
716
 
652
717
  generateDeploySql_meta: true,
653
718
  async generateDeploySql({ conid, database, archiveFolder }, req) {
654
- testConnectionPermission(conid, req);
719
+ await testConnectionPermission(conid, req);
655
720
  const opened = await this.ensureOpened(conid, database);
656
721
  const res = await this.sendRequest(opened, {
657
722
  msgtype: 'generateDeploySql',
@@ -816,17 +881,17 @@ module.exports = {
816
881
  return {
817
882
  ...(command == 'backup'
818
883
  ? driver.backupDatabaseCommand(
819
- connection,
820
- { outputFile, database, options, selectedTables, skippedTables, argsFormat },
821
- // @ts-ignore
822
- externalTools
823
- )
884
+ connection,
885
+ { outputFile, database, options, selectedTables, skippedTables, argsFormat },
886
+ // @ts-ignore
887
+ externalTools
888
+ )
824
889
  : driver.restoreDatabaseCommand(
825
- connection,
826
- { inputFile, database, options, argsFormat },
827
- // @ts-ignore
828
- externalTools
829
- )),
890
+ connection,
891
+ { inputFile, database, options, argsFormat },
892
+ // @ts-ignore
893
+ externalTools
894
+ )),
830
895
  transformMessage: driver.transformNativeCommandMessage
831
896
  ? message => driver.transformNativeCommandMessage(message, command)
832
897
  : null,
@@ -923,8 +988,8 @@ module.exports = {
923
988
 
924
989
  executeSessionQuery_meta: true,
925
990
  async executeSessionQuery({ sesid, conid, database, sql }, req) {
926
- testConnectionPermission(conid, req);
927
- logger.info({ sesid, sql }, 'Processing query');
991
+ await testConnectionPermission(conid, req);
992
+ logger.info({ sesid, sql }, 'DBGM-00010 Processing query');
928
993
  sessions.dispatchMessage(sesid, 'Query execution started');
929
994
 
930
995
  const opened = await this.ensureOpened(conid, database);
@@ -935,7 +1000,7 @@ module.exports = {
935
1000
 
936
1001
  evalJsonScript_meta: true,
937
1002
  async evalJsonScript({ conid, database, script, runid }, req) {
938
- testConnectionPermission(conid, req);
1003
+ await testConnectionPermission(conid, req);
939
1004
  const opened = await this.ensureOpened(conid, database);
940
1005
 
941
1006
  opened.subprocess.send({ msgtype: 'evalJsonScript', script, runid });