@drivelock/n8n-nodes-drivelock 0.2.3 → 0.2.5
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/dist/nodes/Drivelock/Drivelock.node.js +19 -541
- package/dist/nodes/Drivelock/Drivelock.node.js.map +1 -1
- package/dist/nodes/Drivelock/handlers/computerHandler.d.ts +2 -0
- package/dist/nodes/Drivelock/handlers/computerHandler.js +84 -0
- package/dist/nodes/Drivelock/handlers/computerHandler.js.map +1 -0
- package/dist/nodes/Drivelock/handlers/controlRuleHandler.d.ts +5 -0
- package/dist/nodes/Drivelock/handlers/controlRuleHandler.js +72 -0
- package/dist/nodes/Drivelock/handlers/controlRuleHandler.js.map +1 -0
- package/dist/nodes/Drivelock/handlers/customPropertyHandler.d.ts +2 -0
- package/dist/nodes/Drivelock/handlers/customPropertyHandler.js +104 -0
- package/dist/nodes/Drivelock/handlers/customPropertyHandler.js.map +1 -0
- package/dist/nodes/Drivelock/handlers/entityHandler.d.ts +2 -0
- package/dist/nodes/Drivelock/handlers/entityHandler.js +143 -0
- package/dist/nodes/Drivelock/handlers/entityHandler.js.map +1 -0
- package/dist/nodes/Drivelock/handlers/groupHandler.d.ts +2 -0
- package/dist/nodes/Drivelock/handlers/groupHandler.js +33 -0
- package/dist/nodes/Drivelock/handlers/groupHandler.js.map +1 -0
- package/dist/nodes/Drivelock/helper/GenericFunctions.d.ts +1 -0
- package/dist/nodes/Drivelock/helper/GenericFunctions.js +32 -0
- package/dist/nodes/Drivelock/helper/GenericFunctions.js.map +1 -1
- package/dist/nodes/Drivelock/operations/GroupOperations.js +42 -11
- package/dist/nodes/Drivelock/operations/GroupOperations.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/nodes/Drivelock/operations/PolicyOperations.d.ts +0 -2
- package/dist/nodes/Drivelock/operations/PolicyOperations.js +0 -96
- package/dist/nodes/Drivelock/operations/PolicyOperations.js.map +0 -1
|
@@ -1,37 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
4
|
};
|
|
@@ -39,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
6
|
exports.Drivelock = void 0;
|
|
40
7
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
41
8
|
const GenericFunctions_1 = require("./helper/GenericFunctions");
|
|
42
|
-
const FilterBuilder_1 = require("./helper/FilterBuilder");
|
|
43
9
|
const AcBinaries_json_1 = __importDefault(require("./helper/fields/AcBinaries.json"));
|
|
44
10
|
const Computers_json_1 = __importDefault(require("./helper/fields/Computers.json"));
|
|
45
11
|
const DefinedGroupMemberships_json_1 = __importDefault(require("./helper/fields/DefinedGroupMemberships.json"));
|
|
@@ -64,8 +30,6 @@ const FILTER_FIELDS = {
|
|
|
64
30
|
Users: Users_json_1.default,
|
|
65
31
|
WhiteLists: WhiteLists_json_1.default,
|
|
66
32
|
};
|
|
67
|
-
const ValidationHelpers_1 = require("./helper/ValidationHelpers");
|
|
68
|
-
const customPropHelper = __importStar(require("./helper/CustomPropertyHelper"));
|
|
69
33
|
const ApplicationRuleOperations_1 = require("./operations/ApplicationRuleOperations");
|
|
70
34
|
const ComputerOperations_1 = require("./operations/ComputerOperations");
|
|
71
35
|
const CustomPropertyOperations_1 = require("./operations/CustomPropertyOperations");
|
|
@@ -73,81 +37,20 @@ const DeviceRuleOperations_1 = require("./operations/DeviceRuleOperations");
|
|
|
73
37
|
const DriveRuleOperations_1 = require("./operations/DriveRuleOperations");
|
|
74
38
|
const EntityOperations_1 = require("./operations/EntityOperations");
|
|
75
39
|
const GroupOperations_1 = require("./operations/GroupOperations");
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (error !== undefined && error !== null)
|
|
91
|
-
result.error = error;
|
|
92
|
-
if (data !== undefined)
|
|
93
|
-
result.data = data;
|
|
94
|
-
if (total !== undefined)
|
|
95
|
-
result.total = total;
|
|
96
|
-
if (additionalInfo !== undefined && additionalInfo !== null) {
|
|
97
|
-
result.additionalInfo = additionalInfo;
|
|
98
|
-
}
|
|
99
|
-
for (const key of Object.keys(rest)) {
|
|
100
|
-
if (rest[key] !== undefined && rest[key] !== null) {
|
|
101
|
-
result[key] = rest[key];
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return result;
|
|
105
|
-
}
|
|
106
|
-
return { success: true, data: response };
|
|
107
|
-
}
|
|
108
|
-
function getControlRuleConfig(operation) {
|
|
109
|
-
if (operation.includes('Collection')) {
|
|
110
|
-
return { ruleSubPath: 'collections', bodyKey: 'collections' };
|
|
111
|
-
}
|
|
112
|
-
if (operation.includes('Behavior')) {
|
|
113
|
-
return { ruleSubPath: 'behaviorRules', bodyKey: 'rules' };
|
|
114
|
-
}
|
|
115
|
-
return { ruleSubPath: 'rules', bodyKey: 'rules' };
|
|
116
|
-
}
|
|
117
|
-
async function executeControlRuleOperation(execFns, controlPath, dataParamName, operation, i) {
|
|
118
|
-
const configId = execFns.getNodeParameter('configId', i);
|
|
119
|
-
const configVersion = execFns.getNodeParameter('configVersion', i);
|
|
120
|
-
const { ruleSubPath, bodyKey } = getControlRuleConfig(operation);
|
|
121
|
-
const basePath = `/api/administration/${controlPath}/${ruleSubPath}`;
|
|
122
|
-
if (operation.startsWith('get')) {
|
|
123
|
-
const qs = {};
|
|
124
|
-
if (configVersion > 0)
|
|
125
|
-
qs.configVersion = configVersion;
|
|
126
|
-
const response = await GenericFunctions_1.driveLockApiRequest.call(execFns, 'GET', `${basePath}/${configId}`, {}, qs);
|
|
127
|
-
return extractResponseData(response);
|
|
128
|
-
}
|
|
129
|
-
if (operation.startsWith('create') || operation.startsWith('update')) {
|
|
130
|
-
const dataStr = execFns.getNodeParameter(dataParamName, i);
|
|
131
|
-
const parsedData = (0, ValidationHelpers_1.parseJsonParameter)(dataStr, execFns.getNode(), i, dataParamName);
|
|
132
|
-
const body = { configId };
|
|
133
|
-
if (configVersion > 0)
|
|
134
|
-
body.configVersion = configVersion;
|
|
135
|
-
body[bodyKey] = parsedData;
|
|
136
|
-
const method = operation.startsWith('create') ? 'POST' : 'PATCH';
|
|
137
|
-
const response = await GenericFunctions_1.driveLockApiRequest.call(execFns, method, basePath, body);
|
|
138
|
-
return extractResponseData(response);
|
|
139
|
-
}
|
|
140
|
-
if (operation.startsWith('delete')) {
|
|
141
|
-
const ruleIdsStr = execFns.getNodeParameter('ruleIds', i);
|
|
142
|
-
const ruleIds = (0, ValidationHelpers_1.validateCommaSeparatedIds)(ruleIdsStr, execFns.getNode(), i, 'ruleIds');
|
|
143
|
-
const body = { configId, ruleIds };
|
|
144
|
-
if (configVersion > 0)
|
|
145
|
-
body.configVersion = configVersion;
|
|
146
|
-
const response = await GenericFunctions_1.driveLockApiRequest.call(execFns, 'DELETE', basePath, body);
|
|
147
|
-
return extractResponseData(response);
|
|
148
|
-
}
|
|
149
|
-
throw new n8n_workflow_1.NodeOperationError(execFns.getNode(), `Unknown operation: ${operation}`);
|
|
150
|
-
}
|
|
40
|
+
const customPropertyHandler_1 = require("./handlers/customPropertyHandler");
|
|
41
|
+
const computerHandler_1 = require("./handlers/computerHandler");
|
|
42
|
+
const entityHandler_1 = require("./handlers/entityHandler");
|
|
43
|
+
const groupHandler_1 = require("./handlers/groupHandler");
|
|
44
|
+
const controlRuleHandler_1 = require("./handlers/controlRuleHandler");
|
|
45
|
+
const RESOURCE_HANDLERS = {
|
|
46
|
+
customproperty: customPropertyHandler_1.executeCustomPropertyOperation,
|
|
47
|
+
computer: computerHandler_1.executeComputerOperation,
|
|
48
|
+
entity: entityHandler_1.executeEntityOperation,
|
|
49
|
+
group: groupHandler_1.executeGroupOperation,
|
|
50
|
+
applicationRules: controlRuleHandler_1.executeApplicationRulesOperation,
|
|
51
|
+
deviceRules: controlRuleHandler_1.executeDeviceRulesOperation,
|
|
52
|
+
driveRules: controlRuleHandler_1.executeDriveRulesOperation,
|
|
53
|
+
};
|
|
151
54
|
class Drivelock {
|
|
152
55
|
constructor() {
|
|
153
56
|
this.description = {
|
|
@@ -209,16 +112,6 @@ class Drivelock {
|
|
|
209
112
|
value: 'group',
|
|
210
113
|
description: 'Manage groups',
|
|
211
114
|
},
|
|
212
|
-
{
|
|
213
|
-
name: 'Policy',
|
|
214
|
-
value: 'policy',
|
|
215
|
-
description: 'Manage policies',
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
name: 'Tool',
|
|
219
|
-
value: 'tool',
|
|
220
|
-
description: 'Tool to handle DriveLock node data',
|
|
221
|
-
},
|
|
222
115
|
{
|
|
223
116
|
name: 'Manage Schema Extention',
|
|
224
117
|
value: 'customproperty',
|
|
@@ -227,26 +120,6 @@ class Drivelock {
|
|
|
227
120
|
],
|
|
228
121
|
default: 'customproperty',
|
|
229
122
|
},
|
|
230
|
-
{
|
|
231
|
-
displayName: 'Operation',
|
|
232
|
-
name: 'operation',
|
|
233
|
-
type: 'options',
|
|
234
|
-
noDataExpression: true,
|
|
235
|
-
displayOptions: {
|
|
236
|
-
show: {
|
|
237
|
-
resource: ['tool'],
|
|
238
|
-
},
|
|
239
|
-
},
|
|
240
|
-
options: [
|
|
241
|
-
{
|
|
242
|
-
name: 'Change JSON Data-Return to Item Array',
|
|
243
|
-
value: 'changeoutput',
|
|
244
|
-
description: 'Change the output',
|
|
245
|
-
action: 'Change JSON data return to item array',
|
|
246
|
-
},
|
|
247
|
-
],
|
|
248
|
-
default: 'changeoutput',
|
|
249
|
-
},
|
|
250
123
|
...ApplicationRuleOperations_1.applicationRuleOperations,
|
|
251
124
|
...ComputerOperations_1.computerOperations,
|
|
252
125
|
...CustomPropertyOperations_1.customPropertyOperations,
|
|
@@ -254,7 +127,6 @@ class Drivelock {
|
|
|
254
127
|
...DriveRuleOperations_1.driveRuleOperations,
|
|
255
128
|
...EntityOperations_1.entityOperations,
|
|
256
129
|
...GroupOperations_1.groupOperations,
|
|
257
|
-
...PolicyOperations_1.policyOperations,
|
|
258
130
|
],
|
|
259
131
|
};
|
|
260
132
|
this.methods = {
|
|
@@ -447,411 +319,17 @@ class Drivelock {
|
|
|
447
319
|
};
|
|
448
320
|
}
|
|
449
321
|
async execute() {
|
|
450
|
-
var _a, _b;
|
|
451
322
|
const items = this.getInputData();
|
|
452
323
|
const returnData = [];
|
|
453
|
-
const length = items.length;
|
|
454
324
|
const resource = this.getNodeParameter('resource', 0);
|
|
455
325
|
const operation = this.getNodeParameter('operation', 0);
|
|
456
|
-
for (let i = 0; i < length; i++) {
|
|
326
|
+
for (let i = 0; i < items.length; i++) {
|
|
457
327
|
try {
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
var _a;
|
|
462
|
-
const dataArray = (_a = item === null || item === void 0 ? void 0 : item.json) === null || _a === void 0 ? void 0 : _a.data;
|
|
463
|
-
if (!Array.isArray(dataArray)) {
|
|
464
|
-
return [];
|
|
465
|
-
}
|
|
466
|
-
return dataArray.map((dataItem) => ({
|
|
467
|
-
json: dataItem,
|
|
468
|
-
}));
|
|
469
|
-
});
|
|
470
|
-
return [toolOutput];
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
else if (resource === 'customproperty') {
|
|
474
|
-
const schema = this.getNodeParameter('schema', i);
|
|
475
|
-
const schemaExtention = `${schema}Extensions`;
|
|
476
|
-
if (operation === 'check') {
|
|
477
|
-
const createOrUpdateIfNotExists = this.getNodeParameter('createOrUpdateIfNotExists', i);
|
|
478
|
-
const customProperties = this.getNodeParameter('customProperties', i).customPropertyValues;
|
|
479
|
-
let customSchemes = await (GenericFunctions_1.driveLockApiRequest).call(this, 'GET', '/api/administration/entity/customSchema/getCustomSchemas', {});
|
|
480
|
-
if (Array.isArray(customSchemes.data)) {
|
|
481
|
-
throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: 'invalid API response. data should be an object' });
|
|
482
|
-
}
|
|
483
|
-
else if (!customSchemes.data.customProps) {
|
|
484
|
-
throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: 'invalid API response. object is missing' });
|
|
485
|
-
}
|
|
486
|
-
let checkResult = customPropHelper.checkPropsAndTypes(customSchemes.data.customProps[schemaExtention], customProperties);
|
|
487
|
-
let allPropertiesFound = Object.values(checkResult).every((v) => v.name === true);
|
|
488
|
-
let allDataTypesCorrect = Object.values(checkResult).every((v) => v.datatype === true);
|
|
489
|
-
let allNotChanged = Object.values(checkResult).every((v) => v.changed === false);
|
|
490
|
-
if (allDataTypesCorrect && createOrUpdateIfNotExists) {
|
|
491
|
-
const adjustedProps = customPropHelper.adjustProps(checkResult, schemaExtention, customSchemes.data.customProps, customProperties);
|
|
492
|
-
const endpoint = '/api/administration/entity/customSchema/setCustomSchemas';
|
|
493
|
-
const body = { customProps: adjustedProps };
|
|
494
|
-
const updateResult = await GenericFunctions_1.driveLockApiRequest.call(this, 'POST', endpoint, body, {}, { returnFullResponse: true });
|
|
495
|
-
const statusCode = updateResult.statusCode;
|
|
496
|
-
if (statusCode !== undefined && statusCode !== 200) {
|
|
497
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The update errored - returned status-code ${statusCode}. ${JSON.stringify(updateResult.body)}`, { itemIndex: i });
|
|
498
|
-
}
|
|
499
|
-
customSchemes = await (GenericFunctions_1.driveLockApiRequest).call(this, 'GET', '/api/administration/entity/customSchema/getCustomSchemas', {});
|
|
500
|
-
if (Array.isArray(customSchemes.data)) {
|
|
501
|
-
throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: 'invalid API response. data should be an object' });
|
|
502
|
-
}
|
|
503
|
-
else if (!customSchemes.data.customProps) {
|
|
504
|
-
throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: 'invalid API response. object is missing' });
|
|
505
|
-
}
|
|
506
|
-
checkResult = customPropHelper.checkPropsAndTypes(customSchemes.data.customProps[schemaExtention], customProperties);
|
|
507
|
-
allPropertiesFound = Object.values(checkResult).every((v) => v.name === true);
|
|
508
|
-
allDataTypesCorrect = Object.values(checkResult).every((v) => v.datatype === true);
|
|
509
|
-
allNotChanged = Object.values(checkResult).every((v) => v.changed === false);
|
|
510
|
-
}
|
|
511
|
-
const success = allPropertiesFound && allDataTypesCorrect;
|
|
512
|
-
const responseData = { allPropertiesFound, allDataTypesCorrect, allNotChanged, details: checkResult };
|
|
513
|
-
if (success) {
|
|
514
|
-
returnData.push(responseData);
|
|
515
|
-
}
|
|
516
|
-
else {
|
|
517
|
-
const outputData = JSON.stringify(responseData);
|
|
518
|
-
if (!createOrUpdateIfNotExists) {
|
|
519
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Please configure the Custom properties proper here or in DOC. Tick the 'Create properties ...' Button to create missing entries here (or in DOC).\n\nCheck says ${outputData}`, { itemIndex: i });
|
|
520
|
-
}
|
|
521
|
-
else if (!allPropertiesFound) {
|
|
522
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `While trying to create: Some custom properties are missing or have incorrect data types. Details: ${outputData}`, { itemIndex: i });
|
|
523
|
-
}
|
|
524
|
-
else if (!allDataTypesCorrect) {
|
|
525
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Some custom properties have incorrect data types. Details: ${outputData}`, { itemIndex: i });
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
else if (operation === 'update') {
|
|
530
|
-
const customPropertyId = this.getNodeParameter('customPropertyId', i);
|
|
531
|
-
const updateProperties = this.getNodeParameter('updateProperties', i).customPropertiesValues;
|
|
532
|
-
const payload = customPropHelper.createSetPayload(customPropertyId.value, updateProperties);
|
|
533
|
-
const url = `/api/administration/entity/customSchema/setCustomData/${schemaExtention}`;
|
|
534
|
-
await GenericFunctions_1.driveLockApiRequest.call(this, 'POST', url, payload);
|
|
535
|
-
returnData.push({ success: true, payload });
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
else if (resource === 'computer') {
|
|
539
|
-
if (operation === 'delete') {
|
|
540
|
-
const computerIdsStr = this.getNodeParameter('computerIds', i);
|
|
541
|
-
const computerIds = (0, ValidationHelpers_1.validateCommaSeparatedIds)(computerIdsStr, this.getNode(), i, 'computerIds');
|
|
542
|
-
const deleteRecoveryData = this.getNodeParameter('deleteRecoveryData', i);
|
|
543
|
-
const deleteEvents = this.getNodeParameter('deleteEvents', i);
|
|
544
|
-
const deleteGroupDefinitions = this.getNodeParameter('deleteGroupDefinitions', i);
|
|
545
|
-
const body = {
|
|
546
|
-
computerIds,
|
|
547
|
-
deleteRecoveryData,
|
|
548
|
-
deleteEvents,
|
|
549
|
-
deleteGroupDefinitions,
|
|
550
|
-
};
|
|
551
|
-
const response = await GenericFunctions_1.driveLockApiRequest.call(this, 'POST', '/api/administration/computer/delete', body);
|
|
552
|
-
returnData.push(extractResponseData(response));
|
|
553
|
-
}
|
|
554
|
-
else if (operation === 'executeActions') {
|
|
555
|
-
const computerIdsStr = this.getNodeParameter('computerIds', i);
|
|
556
|
-
const computerIds = (0, ValidationHelpers_1.validateCommaSeparatedIds)(computerIdsStr, this.getNode(), i, 'computerIds');
|
|
557
|
-
const actionsStr = this.getNodeParameter('actions', i);
|
|
558
|
-
const notifyAgent = this.getNodeParameter('notifyAgent', i);
|
|
559
|
-
const actions = (0, ValidationHelpers_1.parseJsonParameter)(actionsStr, this.getNode(), i, 'actions');
|
|
560
|
-
const body = { computerIds, actions, notifyAgent };
|
|
561
|
-
const response = await GenericFunctions_1.driveLockApiRequest.call(this, 'POST', '/api/administration/computer/actions', body);
|
|
562
|
-
returnData.push(extractResponseData(response));
|
|
563
|
-
}
|
|
564
|
-
else if (operation === 'onlineUnlock') {
|
|
565
|
-
const computerId = this.getNodeParameter('computerId', i);
|
|
566
|
-
const unlockDataStr = this.getNodeParameter('unlockData', i);
|
|
567
|
-
const data = (0, ValidationHelpers_1.parseJsonParameter)(unlockDataStr, this.getNode(), i, 'unlockData');
|
|
568
|
-
const body = { computerId, data };
|
|
569
|
-
const response = await GenericFunctions_1.driveLockApiRequest.call(this, 'POST', '/api/administration/computer/online/unlock', body);
|
|
570
|
-
returnData.push(extractResponseData(response));
|
|
571
|
-
}
|
|
572
|
-
else if (operation === 'stopOnlineUnlock') {
|
|
573
|
-
const computerId = this.getNodeParameter('computerId', i);
|
|
574
|
-
const body = { computerId };
|
|
575
|
-
const response = await GenericFunctions_1.driveLockApiRequest.call(this, 'POST', '/api/administration/computer/online/stopUnlock', body);
|
|
576
|
-
returnData.push(extractResponseData(response));
|
|
577
|
-
}
|
|
578
|
-
else if (operation === 'markForRejoin') {
|
|
579
|
-
const computerIdsStr = this.getNodeParameter('computerIds', i);
|
|
580
|
-
const computerIds = (0, ValidationHelpers_1.validateCommaSeparatedIds)(computerIdsStr, this.getNode(), i, 'computerIds');
|
|
581
|
-
const allowToRejoin = this.getNodeParameter('allowToRejoin', i);
|
|
582
|
-
const body = { computerIds, allowToRejoin };
|
|
583
|
-
const response = await GenericFunctions_1.driveLockApiRequest.call(this, 'POST', '/api/administration/computer/markAgentForRejoin', body);
|
|
584
|
-
returnData.push(extractResponseData(response));
|
|
585
|
-
}
|
|
586
|
-
else if (operation === 'clearAgentIdToken') {
|
|
587
|
-
const computerId = this.getNodeParameter('computerId', i);
|
|
588
|
-
const body = { computerId };
|
|
589
|
-
const response = await GenericFunctions_1.driveLockApiRequest.call(this, 'POST', '/api/administration/computer/clearAgentIdToken', body);
|
|
590
|
-
returnData.push(extractResponseData(response));
|
|
591
|
-
}
|
|
592
|
-
else if (operation === 'setImageFlag') {
|
|
593
|
-
const computerId = this.getNodeParameter('computerId', i);
|
|
594
|
-
const imageFlag = this.getNodeParameter('imageFlag', i);
|
|
595
|
-
const body = { computerId, imageFlag };
|
|
596
|
-
const response = await GenericFunctions_1.driveLockApiRequest.call(this, 'POST', '/api/administration/computer/setImageFlag', body);
|
|
597
|
-
returnData.push(extractResponseData(response));
|
|
598
|
-
}
|
|
599
|
-
else if (operation === 'stopOnlineUnlocks') {
|
|
600
|
-
const computerIdsStr = this.getNodeParameter('computerIds', i);
|
|
601
|
-
const computerIds = computerIdsStr.split(',').map((id) => id.trim()).filter(Boolean);
|
|
602
|
-
const body = { computerIds };
|
|
603
|
-
const response = await GenericFunctions_1.driveLockApiRequest.call(this, 'POST', '/api/administration/computer/stopOnlineUnlocks', body);
|
|
604
|
-
returnData.push(extractResponseData(response));
|
|
605
|
-
}
|
|
606
|
-
else if (operation === 'bitlockerRecovery') {
|
|
607
|
-
const recoveryId = this.getNodeParameter('recoveryId', i);
|
|
608
|
-
const body = { recoveryId };
|
|
609
|
-
const response = await GenericFunctions_1.driveLockApiRequest.call(this, 'POST', '/api/administration/computer/recovery/bitlockerRecovery', body);
|
|
610
|
-
returnData.push(extractResponseData(response));
|
|
611
|
-
}
|
|
612
|
-
else if (operation === 'bitlocker2goRecovery') {
|
|
613
|
-
const recoveryId = this.getNodeParameter('recoveryId', i);
|
|
614
|
-
const body = { recoveryId };
|
|
615
|
-
const response = await GenericFunctions_1.driveLockApiRequest.call(this, 'POST', '/api/administration/computer/recovery/bitlocker2goRecovery', body);
|
|
616
|
-
returnData.push(extractResponseData(response));
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
else if (resource === 'entity') {
|
|
620
|
-
const entityName = this.getNodeParameter('entityName', i);
|
|
621
|
-
if (operation === 'getList') {
|
|
622
|
-
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
623
|
-
const qs = {};
|
|
624
|
-
if (['AcBinaries', 'Computers', 'Users', 'Devices', 'Softwares', 'DefinedGroupMemberships', 'DriveLockConfigs', 'Drives', 'Events', 'Groups', 'WhiteLists'].includes(entityName)) {
|
|
625
|
-
const propertiesMode = this.getNodeParameter('propertiesMode', i, 'builder');
|
|
626
|
-
if (propertiesMode === 'raw') {
|
|
627
|
-
const propertiesRaw = this.getNodeParameter('propertiesRaw', i, '');
|
|
628
|
-
if (propertiesRaw)
|
|
629
|
-
qs.select = `id,${propertiesRaw}`;
|
|
630
|
-
}
|
|
631
|
-
else {
|
|
632
|
-
const propertiesToInclude = this.getNodeParameter('properties', i, []);
|
|
633
|
-
if (Array.isArray(propertiesToInclude) && propertiesToInclude.length) {
|
|
634
|
-
qs.select = `id,${propertiesToInclude.join(',')}`;
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
const sortMode = this.getNodeParameter('sortMode', i, 'builder');
|
|
638
|
-
if (sortMode === 'raw') {
|
|
639
|
-
const sortRaw = this.getNodeParameter('sortRaw', i, '');
|
|
640
|
-
if (sortRaw)
|
|
641
|
-
qs.sortBy = sortRaw;
|
|
642
|
-
}
|
|
643
|
-
else {
|
|
644
|
-
const sortFieldsParam = this.getNodeParameter('sortFields', i, { fields: [] });
|
|
645
|
-
if ((_a = sortFieldsParam.fields) === null || _a === void 0 ? void 0 : _a.length) {
|
|
646
|
-
qs.sortBy = sortFieldsParam.fields.map((f) => `${f.direction}${f.field}`).join(',');
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
if (additionalFields.getFullObjects !== undefined)
|
|
650
|
-
qs.getFullObjects = additionalFields.getFullObjects;
|
|
651
|
-
}
|
|
652
|
-
else {
|
|
653
|
-
if (additionalFields.select)
|
|
654
|
-
qs.select = additionalFields.select;
|
|
655
|
-
if (additionalFields.sortBy)
|
|
656
|
-
qs.sortBy = additionalFields.sortBy;
|
|
657
|
-
}
|
|
658
|
-
if (additionalFields.groupBy)
|
|
659
|
-
qs.groupBy = additionalFields.groupBy;
|
|
660
|
-
if (additionalFields.skip !== undefined)
|
|
661
|
-
qs.skip = additionalFields.skip;
|
|
662
|
-
if (additionalFields.take !== undefined)
|
|
663
|
-
qs.take = additionalFields.take;
|
|
664
|
-
if (additionalFields.getTotalCount !== undefined)
|
|
665
|
-
qs.getTotalCount = additionalFields.getTotalCount;
|
|
666
|
-
if (additionalFields.includeLinkedObjects !== undefined)
|
|
667
|
-
qs.includeLinkedObjects = additionalFields.includeLinkedObjects;
|
|
668
|
-
if (additionalFields.getAsFlattenedList !== undefined)
|
|
669
|
-
qs.getAsFlattenedList = additionalFields.getAsFlattenedList;
|
|
670
|
-
const filterMode = this.getNodeParameter('filterMode', i, 'builder');
|
|
671
|
-
const filterRaw = this.getNodeParameter('filterRaw', i, '');
|
|
672
|
-
const filterCombinator = this.getNodeParameter('filterCombinator', i, 'and');
|
|
673
|
-
const filterGroupsParam = this.getNodeParameter('filterGroups', i, { groups: [] });
|
|
674
|
-
const builtQuery = (0, FilterBuilder_1.buildFilterQuery)(filterMode, filterRaw, filterCombinator, filterGroupsParam);
|
|
675
|
-
if (builtQuery)
|
|
676
|
-
qs.query = builtQuery;
|
|
677
|
-
const response = await GenericFunctions_1.driveLockApiRequest.call(this, 'GET', `/api/administration/entity/${entityName}`, {}, qs);
|
|
678
|
-
returnData.push(extractResponseData(response));
|
|
679
|
-
}
|
|
680
|
-
else if (operation === 'getCount') {
|
|
681
|
-
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
682
|
-
const qs = {};
|
|
683
|
-
if (additionalFields.groupBy)
|
|
684
|
-
qs.groupBy = additionalFields.groupBy;
|
|
685
|
-
const filterMode = this.getNodeParameter('filterMode', i, 'builder');
|
|
686
|
-
const filterRaw = this.getNodeParameter('filterRaw', i, '');
|
|
687
|
-
const filterCombinator = this.getNodeParameter('filterCombinator', i, 'and');
|
|
688
|
-
const filterGroupsParam = this.getNodeParameter('filterGroups', i, { groups: [] });
|
|
689
|
-
const builtQuery = (0, FilterBuilder_1.buildFilterQuery)(filterMode, filterRaw, filterCombinator, filterGroupsParam);
|
|
690
|
-
if (builtQuery)
|
|
691
|
-
qs.query = builtQuery;
|
|
692
|
-
const response = await GenericFunctions_1.driveLockApiRequest.call(this, 'GET', `/api/administration/entity/${entityName}/count`, {}, qs);
|
|
693
|
-
returnData.push(extractResponseData(response));
|
|
694
|
-
}
|
|
695
|
-
else if (operation === 'getById') {
|
|
696
|
-
const entityId = this.getNodeParameter('entityId', i);
|
|
697
|
-
const includeLinkedObjects = this.getNodeParameter('includeLinkedObjects', i);
|
|
698
|
-
const qs = { includeLinkedObjects };
|
|
699
|
-
const response = await GenericFunctions_1.driveLockApiRequest.call(this, 'GET', `/api/administration/entity/${entityName}/${entityId}`, {}, qs);
|
|
700
|
-
returnData.push(extractResponseData(response));
|
|
701
|
-
}
|
|
702
|
-
else if (operation === 'export') {
|
|
703
|
-
const exportFormat = this.getNodeParameter('exportFormat', i);
|
|
704
|
-
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
705
|
-
const exportOptions = this.getNodeParameter('exportOptions', i);
|
|
706
|
-
const qs = { exportFormat };
|
|
707
|
-
if (['AcBinaries', 'Computers', 'Users', 'Devices', 'Softwares', 'DefinedGroupMemberships', 'DriveLockConfigs', 'Drives', 'Events', 'Groups', 'WhiteLists'].includes(entityName)) {
|
|
708
|
-
const propertiesMode = this.getNodeParameter('propertiesMode', i, 'builder');
|
|
709
|
-
if (propertiesMode === 'raw') {
|
|
710
|
-
const propertiesRaw = this.getNodeParameter('propertiesRaw', i, '');
|
|
711
|
-
if (propertiesRaw)
|
|
712
|
-
qs.select = `id,${propertiesRaw}`;
|
|
713
|
-
}
|
|
714
|
-
else {
|
|
715
|
-
const propertiesToInclude = this.getNodeParameter('properties', i, []);
|
|
716
|
-
if (Array.isArray(propertiesToInclude) && propertiesToInclude.length) {
|
|
717
|
-
qs.select = `id,${propertiesToInclude.join(',')}`;
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
const sortMode = this.getNodeParameter('sortMode', i, 'builder');
|
|
721
|
-
if (sortMode === 'raw') {
|
|
722
|
-
const sortRaw = this.getNodeParameter('sortRaw', i, '');
|
|
723
|
-
if (sortRaw)
|
|
724
|
-
qs.sortBy = sortRaw;
|
|
725
|
-
}
|
|
726
|
-
else {
|
|
727
|
-
const sortFieldsParam = this.getNodeParameter('sortFields', i, { fields: [] });
|
|
728
|
-
if ((_b = sortFieldsParam.fields) === null || _b === void 0 ? void 0 : _b.length) {
|
|
729
|
-
qs.sortBy = sortFieldsParam.fields.map((f) => `${f.direction}${f.field}`).join(',');
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
if (additionalFields.getFullObjects !== undefined)
|
|
733
|
-
qs.getFullObjects = additionalFields.getFullObjects;
|
|
734
|
-
}
|
|
735
|
-
else {
|
|
736
|
-
if (additionalFields.select)
|
|
737
|
-
qs.select = additionalFields.select;
|
|
738
|
-
if (additionalFields.sortBy)
|
|
739
|
-
qs.sortBy = additionalFields.sortBy;
|
|
740
|
-
}
|
|
741
|
-
if (additionalFields.groupBy)
|
|
742
|
-
qs.groupBy = additionalFields.groupBy;
|
|
743
|
-
if (additionalFields.skip !== undefined)
|
|
744
|
-
qs.skip = additionalFields.skip;
|
|
745
|
-
if (additionalFields.take !== undefined)
|
|
746
|
-
qs.take = additionalFields.take;
|
|
747
|
-
if (additionalFields.includeLinkedObjects !== undefined)
|
|
748
|
-
qs.includeLinkedObjects = additionalFields.includeLinkedObjects;
|
|
749
|
-
if (additionalFields.getAsFlattenedList !== undefined)
|
|
750
|
-
qs.getAsFlattenedList = additionalFields.getAsFlattenedList;
|
|
751
|
-
if (additionalFields.maskUserProperties !== undefined)
|
|
752
|
-
qs.maskUserProperties = additionalFields.maskUserProperties;
|
|
753
|
-
if (additionalFields.maskComputerProperties !== undefined)
|
|
754
|
-
qs.maskComputerProperties = additionalFields.maskComputerProperties;
|
|
755
|
-
const filterMode = this.getNodeParameter('filterMode', i, 'builder');
|
|
756
|
-
const filterRaw = this.getNodeParameter('filterRaw', i, '');
|
|
757
|
-
const filterCombinator = this.getNodeParameter('filterCombinator', i, 'and');
|
|
758
|
-
const filterGroupsParam = this.getNodeParameter('filterGroups', i, { groups: [] });
|
|
759
|
-
const builtQuery = (0, FilterBuilder_1.buildFilterQuery)(filterMode, filterRaw, filterCombinator, filterGroupsParam);
|
|
760
|
-
if (builtQuery)
|
|
761
|
-
qs.query = builtQuery;
|
|
762
|
-
if (exportOptions.readability !== undefined)
|
|
763
|
-
qs.readability = exportOptions.readability;
|
|
764
|
-
if (exportOptions.separator)
|
|
765
|
-
qs.separator = exportOptions.separator;
|
|
766
|
-
if (exportOptions.language)
|
|
767
|
-
qs.language = exportOptions.language;
|
|
768
|
-
const response = await GenericFunctions_1.driveLockApiRequest.call(this, 'GET', `/api/administration/entity/${entityName}/export`, {}, qs, { json: false });
|
|
769
|
-
returnData.push(extractResponseData(response));
|
|
770
|
-
}
|
|
771
|
-
else if (operation === 'getPermissions') {
|
|
772
|
-
const entityId = this.getNodeParameter('entityId', i);
|
|
773
|
-
const body = { entityName, entityId };
|
|
774
|
-
const permResponse = await GenericFunctions_1.driveLockApiRequest.call(this, 'POST', '/api/administration/entity/getEntityPermissions', body);
|
|
775
|
-
returnData.push(extractResponseData(permResponse));
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
else if (resource === 'group') {
|
|
779
|
-
if (operation === 'addComputersToGroup') {
|
|
780
|
-
const groupId = this.getNodeParameter('groupId', i);
|
|
781
|
-
const membershipsStr = this.getNodeParameter('memberships', i);
|
|
782
|
-
const memberships = (0, ValidationHelpers_1.parseJsonParameter)(membershipsStr, this.getNode(), i, 'memberships');
|
|
783
|
-
const body = { groupId, memberships };
|
|
784
|
-
const response = await GenericFunctions_1.driveLockApiRequest.call(this, 'POST', '/api/administration/group/definedGroupMemberships/computers', body);
|
|
785
|
-
returnData.push(extractResponseData(response));
|
|
786
|
-
}
|
|
787
|
-
else if (operation === 'removeGroupMemberships') {
|
|
788
|
-
const membershipIdsStr = this.getNodeParameter('membershipIds', i);
|
|
789
|
-
const membershipIds = (0, ValidationHelpers_1.validateCommaSeparatedIds)(membershipIdsStr, this.getNode(), i, 'membershipIds');
|
|
790
|
-
const response = await GenericFunctions_1.driveLockApiRequest.call(this, 'DELETE', '/api/administration/group/definedGroupMemberships', membershipIds);
|
|
791
|
-
returnData.push(extractResponseData(response));
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
else if (resource === 'applicationRules') {
|
|
795
|
-
returnData.push(await executeControlRuleOperation(this, 'applicationControl', 'rules', operation, i));
|
|
796
|
-
}
|
|
797
|
-
else if (resource === 'deviceRules') {
|
|
798
|
-
if (operation === 'getRule') {
|
|
799
|
-
const ruleId = this.getNodeParameter('ruleId', i);
|
|
800
|
-
const response = await GenericFunctions_1.driveLockApiRequest.call(this, 'GET', `/api/administration/deviceControl/rules/${ruleId}`);
|
|
801
|
-
returnData.push(extractResponseData(response));
|
|
802
|
-
}
|
|
803
|
-
else {
|
|
804
|
-
returnData.push(await executeControlRuleOperation(this, 'deviceControl', 'rulesData', operation, i));
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
else if (resource === 'driveRules') {
|
|
808
|
-
if (operation === 'getRule') {
|
|
809
|
-
const ruleId = this.getNodeParameter('ruleId', i);
|
|
810
|
-
const response = await GenericFunctions_1.driveLockApiRequest.call(this, 'GET', `/api/administration/driveControl/rules/${ruleId}`);
|
|
811
|
-
returnData.push(extractResponseData(response));
|
|
812
|
-
}
|
|
813
|
-
else {
|
|
814
|
-
returnData.push(await executeControlRuleOperation(this, 'driveControl', 'rulesData', operation, i));
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
else if (resource === 'policy') {
|
|
818
|
-
if (operation === 'get') {
|
|
819
|
-
const policyId = this.getNodeParameter('policyId', i);
|
|
820
|
-
const response = await GenericFunctions_1.driveLockApiRequest.call(this, 'GET', `/api/administration/policy/${policyId}`);
|
|
821
|
-
returnData.push(extractResponseData(response));
|
|
822
|
-
}
|
|
823
|
-
else if (operation === 'create') {
|
|
824
|
-
const policyDataStr = this.getNodeParameter('policyData', i);
|
|
825
|
-
const policyData = (0, ValidationHelpers_1.parseJsonParameter)(policyDataStr, this.getNode(), i, 'policyData');
|
|
826
|
-
const response = await GenericFunctions_1.driveLockApiRequest.call(this, 'POST', '/api/administration/policy', policyData);
|
|
827
|
-
returnData.push(extractResponseData(response));
|
|
828
|
-
}
|
|
829
|
-
else if (operation === 'update') {
|
|
830
|
-
const policyId = this.getNodeParameter('policyId', i);
|
|
831
|
-
const policyDataStr = this.getNodeParameter('policyData', i);
|
|
832
|
-
const policyData = (0, ValidationHelpers_1.parseJsonParameter)(policyDataStr, this.getNode(), i, 'policyData');
|
|
833
|
-
const response = await GenericFunctions_1.driveLockApiRequest.call(this, 'PATCH', `/api/administration/policy/${policyId}`, policyData);
|
|
834
|
-
returnData.push(extractResponseData(response));
|
|
835
|
-
}
|
|
836
|
-
else if (operation === 'delete') {
|
|
837
|
-
const policyId = this.getNodeParameter('policyId', i);
|
|
838
|
-
const response = await GenericFunctions_1.driveLockApiRequest.call(this, 'DELETE', `/api/administration/policy/${policyId}`);
|
|
839
|
-
returnData.push(extractResponseData(response));
|
|
840
|
-
}
|
|
841
|
-
else if (operation === 'getAssignments') {
|
|
842
|
-
const policyId = this.getNodeParameter('policyId', i);
|
|
843
|
-
const response = await GenericFunctions_1.driveLockApiRequest.call(this, 'GET', `/api/administration/policy/${policyId}/assignments`);
|
|
844
|
-
returnData.push(extractResponseData(response));
|
|
845
|
-
}
|
|
846
|
-
else if (operation === 'assignToGroups') {
|
|
847
|
-
const policyId = this.getNodeParameter('policyId', i);
|
|
848
|
-
const groupIdsStr = this.getNodeParameter('groupIds', i);
|
|
849
|
-
const groupIds = (0, ValidationHelpers_1.validateCommaSeparatedIds)(groupIdsStr, this.getNode(), i, 'groupIds');
|
|
850
|
-
const body = { policyId, groupIds };
|
|
851
|
-
const response = await GenericFunctions_1.driveLockApiRequest.call(this, 'POST', `/api/administration/policy/${policyId}/assign`, body);
|
|
852
|
-
returnData.push(extractResponseData(response));
|
|
853
|
-
}
|
|
328
|
+
const handler = RESOURCE_HANDLERS[resource];
|
|
329
|
+
if (!handler) {
|
|
330
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown resource: ${resource}`);
|
|
854
331
|
}
|
|
332
|
+
returnData.push(await handler(this, operation, i));
|
|
855
333
|
}
|
|
856
334
|
catch (error) {
|
|
857
335
|
if (this.continueOnFail()) {
|