dbgate-api 7.1.0 → 7.1.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.
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dbgate-api",
|
|
3
3
|
"main": "src/index.js",
|
|
4
|
-
"version": "7.1.
|
|
4
|
+
"version": "7.1.2",
|
|
5
5
|
"homepage": "https://www.dbgate.io/",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"compare-versions": "^3.6.0",
|
|
31
31
|
"cors": "^2.8.5",
|
|
32
32
|
"cross-env": "^6.0.3",
|
|
33
|
-
"dbgate-datalib": "^7.1.
|
|
34
|
-
"dbgate-query-splitter": "^4.
|
|
35
|
-
"dbgate-rest": "^7.1.
|
|
36
|
-
"dbgate-sqltree": "^7.1.
|
|
37
|
-
"dbgate-tools": "^7.1.
|
|
33
|
+
"dbgate-datalib": "^7.1.2",
|
|
34
|
+
"dbgate-query-splitter": "^4.12.0",
|
|
35
|
+
"dbgate-rest": "^7.1.2",
|
|
36
|
+
"dbgate-sqltree": "^7.1.2",
|
|
37
|
+
"dbgate-tools": "^7.1.2",
|
|
38
38
|
"debug": "^4.3.4",
|
|
39
39
|
"diff": "^5.0.0",
|
|
40
40
|
"diff2html": "^3.4.13",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"devDependencies": {
|
|
89
89
|
"@types/fs-extra": "^9.0.11",
|
|
90
90
|
"@types/lodash": "^4.14.149",
|
|
91
|
-
"dbgate-types": "^7.1.
|
|
91
|
+
"dbgate-types": "^7.1.2",
|
|
92
92
|
"env-cmd": "^10.1.0",
|
|
93
93
|
"jsdoc-to-markdown": "^9.0.5",
|
|
94
94
|
"node-loader": "^1.0.2",
|
|
@@ -15,6 +15,7 @@ const {
|
|
|
15
15
|
getLogger,
|
|
16
16
|
extractErrorLogData,
|
|
17
17
|
filterStructureBySchema,
|
|
18
|
+
serializeJsTypesForJsonStringify,
|
|
18
19
|
} = require('dbgate-tools');
|
|
19
20
|
const { html, parse } = require('diff2html');
|
|
20
21
|
const { handleProcessCommunication } = require('../utility/processComm');
|
|
@@ -224,12 +225,13 @@ module.exports = {
|
|
|
224
225
|
this.close(conid, database, false);
|
|
225
226
|
});
|
|
226
227
|
|
|
227
|
-
|
|
228
|
+
const connectMessage = serializeJsTypesForJsonStringify({
|
|
228
229
|
msgtype: 'connect',
|
|
229
230
|
connection: { ...connection, database },
|
|
230
231
|
structure: lastClosed ? lastClosed.structure : null,
|
|
231
232
|
globalSettings: await config.getSettings(),
|
|
232
233
|
});
|
|
234
|
+
subprocess.send(connectMessage);
|
|
233
235
|
return newOpened;
|
|
234
236
|
},
|
|
235
237
|
|
|
@@ -239,7 +241,8 @@ module.exports = {
|
|
|
239
241
|
const promise = new Promise((resolve, reject) => {
|
|
240
242
|
this.requests[msgid] = [resolve, reject, additionalData];
|
|
241
243
|
try {
|
|
242
|
-
|
|
244
|
+
const serializedMessage = serializeJsTypesForJsonStringify({ msgid, ...message });
|
|
245
|
+
conn.subprocess.send(serializedMessage);
|
|
243
246
|
} catch (err) {
|
|
244
247
|
logger.error(extractErrorLogData(err), 'DBGM-00115 Error sending request do process');
|
|
245
248
|
this.close(conn.conid, conn.database);
|
|
@@ -473,6 +476,7 @@ module.exports = {
|
|
|
473
476
|
|
|
474
477
|
const databasePermissions = await loadDatabasePermissionsFromRequest(req);
|
|
475
478
|
const tablePermissions = await loadTablePermissionsFromRequest(req);
|
|
479
|
+
const databasePermissionRole = getDatabasePermissionRole(conid, database, databasePermissions);
|
|
476
480
|
const fieldsAndRoles = [
|
|
477
481
|
[changeSet.inserts, 'create_update_delete'],
|
|
478
482
|
[changeSet.deletes, 'create_update_delete'],
|
|
@@ -487,7 +491,7 @@ module.exports = {
|
|
|
487
491
|
operation.schemaName,
|
|
488
492
|
operation.pureName,
|
|
489
493
|
tablePermissions,
|
|
490
|
-
|
|
494
|
+
databasePermissionRole
|
|
491
495
|
);
|
|
492
496
|
if (getTablePermissionRoleLevelIndex(role) < getTablePermissionRoleLevelIndex(requiredRole)) {
|
|
493
497
|
throw new Error('DBGM-00262 Permission not granted');
|
|
@@ -171,7 +171,7 @@ module.exports = {
|
|
|
171
171
|
const databasePermissions = await loadDatabasePermissionsFromRequest(req);
|
|
172
172
|
const res = [];
|
|
173
173
|
for (const db of opened?.databases ?? []) {
|
|
174
|
-
const databasePermissionRole = getDatabasePermissionRole(
|
|
174
|
+
const databasePermissionRole = getDatabasePermissionRole(conid, db.name, databasePermissions);
|
|
175
175
|
if (databasePermissionRole != 'deny') {
|
|
176
176
|
res.push({
|
|
177
177
|
...db,
|
package/src/currentVersion.js
CHANGED
|
@@ -96,8 +96,9 @@ async function loadFilePermissionsFromRequest(req) {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
function matchDatabasePermissionRow(conid, database, permissionRow) {
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
const connectionIdentifier = permissionRow.connection_conid ?? permissionRow.connection_id;
|
|
100
|
+
if (connectionIdentifier) {
|
|
101
|
+
if (conid != connectionIdentifier) {
|
|
101
102
|
return false;
|
|
102
103
|
}
|
|
103
104
|
}
|