n8n-nodes-arubaclearpass 1.0.0
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/credentials/ClearPassApi.credentials.d.ts +7 -0
- package/dist/credentials/ClearPassApi.credentials.js +69 -0
- package/dist/credentials/ClearPassOAuth2Api.credentials.d.ts +10 -0
- package/dist/credentials/ClearPassOAuth2Api.credentials.js +55 -0
- package/dist/nodes/ArubaCentral/clearpass.svg +4 -0
- package/dist/nodes/ArubaClearPass/ArubaClearPass.node.d.ts +5 -0
- package/dist/nodes/ArubaClearPass/ArubaClearPass.node.js +173 -0
- package/dist/nodes/ArubaClearPass/descriptions/EnforcementProfile/EnforcementProfile.descriptions.d.ts +4 -0
- package/dist/nodes/ArubaClearPass/descriptions/EnforcementProfile/EnforcementProfile.descriptions.js +361 -0
- package/dist/nodes/ArubaClearPass/descriptions/EnforcementProfile/index.d.ts +2 -0
- package/dist/nodes/ArubaClearPass/descriptions/EnforcementProfile/index.js +11 -0
- package/dist/nodes/ArubaClearPass/descriptions/Identities/ApiClient.descriptions.d.ts +0 -0
- package/dist/nodes/ArubaClearPass/descriptions/Identities/ApiClient.descriptions.js +0 -0
- package/dist/nodes/ArubaClearPass/descriptions/Identities/DenyListedUsers.descriptions.d.ts +0 -0
- package/dist/nodes/ArubaClearPass/descriptions/Identities/DenyListedUsers.descriptions.js +0 -0
- package/dist/nodes/ArubaClearPass/descriptions/Identities/Device.descriptions.d.ts +4 -0
- package/dist/nodes/ArubaClearPass/descriptions/Identities/Device.descriptions.js +668 -0
- package/dist/nodes/ArubaClearPass/descriptions/Identities/Endpoint.descriptions.d.ts +4 -0
- package/dist/nodes/ArubaClearPass/descriptions/Identities/Endpoint.descriptions.js +255 -0
- package/dist/nodes/ArubaClearPass/descriptions/Identities/ExternalAccount.descriptions.d.ts +0 -0
- package/dist/nodes/ArubaClearPass/descriptions/Identities/ExternalAccount.descriptions.js +0 -0
- package/dist/nodes/ArubaClearPass/descriptions/Identities/GuestUser.descriptions.d.ts +4 -0
- package/dist/nodes/ArubaClearPass/descriptions/Identities/GuestUser.descriptions.js +477 -0
- package/dist/nodes/ArubaClearPass/descriptions/Identities/LocalUser.descriptions.d.ts +4 -0
- package/dist/nodes/ArubaClearPass/descriptions/Identities/LocalUser.descriptions.js +384 -0
- package/dist/nodes/ArubaClearPass/descriptions/Identities/StaticHostList.descriptions.d.ts +0 -0
- package/dist/nodes/ArubaClearPass/descriptions/Identities/StaticHostList.descriptions.js +0 -0
- package/dist/nodes/ArubaClearPass/descriptions/Identities/index.d.ts +2 -0
- package/dist/nodes/ArubaClearPass/descriptions/Identities/index.js +23 -0
- package/dist/nodes/ArubaClearPass/descriptions/PolicyElements/EnforcementPolicy.descriptions.d.ts +4 -0
- package/dist/nodes/ArubaClearPass/descriptions/PolicyElements/EnforcementPolicy.descriptions.js +432 -0
- package/dist/nodes/ArubaClearPass/descriptions/PolicyElements/Role.descriptions.d.ts +4 -0
- package/dist/nodes/ArubaClearPass/descriptions/PolicyElements/Role.descriptions.js +263 -0
- package/dist/nodes/ArubaClearPass/descriptions/PolicyElements/RoleMapping.descriptions.d.ts +4 -0
- package/dist/nodes/ArubaClearPass/descriptions/PolicyElements/RoleMapping.descriptions.js +365 -0
- package/dist/nodes/ArubaClearPass/descriptions/PolicyElements/index.d.ts +2 -0
- package/dist/nodes/ArubaClearPass/descriptions/PolicyElements/index.js +19 -0
- package/dist/nodes/ArubaClearPass/helpers/apiRequest.d.ts +9 -0
- package/dist/nodes/ArubaClearPass/helpers/apiRequest.js +72 -0
- package/dist/nodes/ArubaClearPass/helpers/errorHandler.d.ts +4 -0
- package/dist/nodes/ArubaClearPass/helpers/errorHandler.js +31 -0
- package/dist/nodes/ArubaClearPass/helpers/executeOperation.d.ts +5 -0
- package/dist/nodes/ArubaClearPass/helpers/executeOperation.js +164 -0
- package/dist/nodes/ArubaClearPass/helpers/responseFormatter.d.ts +5 -0
- package/dist/nodes/ArubaClearPass/helpers/responseFormatter.js +17 -0
- package/dist/nodes/ArubaClearPass/helpers/tokenManager.d.ts +5 -0
- package/dist/nodes/ArubaClearPass/helpers/tokenManager.js +63 -0
- package/dist/nodes/ArubaClearPass/methods/EnforcementProfile/EnforcementProfile.methods.d.ts +41 -0
- package/dist/nodes/ArubaClearPass/methods/EnforcementProfile/EnforcementProfile.methods.js +395 -0
- package/dist/nodes/ArubaClearPass/methods/Identities/Device.methods.d.ts +41 -0
- package/dist/nodes/ArubaClearPass/methods/Identities/Device.methods.js +409 -0
- package/dist/nodes/ArubaClearPass/methods/Identities/Endpoint.methods.d.ts +33 -0
- package/dist/nodes/ArubaClearPass/methods/Identities/Endpoint.methods.js +212 -0
- package/dist/nodes/ArubaClearPass/methods/Identities/GuestUser.methods.d.ts +41 -0
- package/dist/nodes/ArubaClearPass/methods/Identities/GuestUser.methods.js +589 -0
- package/dist/nodes/ArubaClearPass/methods/Identities/LocalUser.methods.d.ts +41 -0
- package/dist/nodes/ArubaClearPass/methods/Identities/LocalUser.methods.js +407 -0
- package/dist/nodes/ArubaClearPass/methods/PolicyElements/EnforcementPolicy.methods.d.ts +41 -0
- package/dist/nodes/ArubaClearPass/methods/PolicyElements/EnforcementPolicy.methods.js +361 -0
- package/dist/nodes/ArubaClearPass/methods/PolicyElements/Role.methods.d.ts +41 -0
- package/dist/nodes/ArubaClearPass/methods/PolicyElements/Role.methods.js +298 -0
- package/dist/nodes/ArubaClearPass/methods/PolicyElements/RoleMapping.methods.d.ts +41 -0
- package/dist/nodes/ArubaClearPass/methods/PolicyElements/RoleMapping.methods.js +358 -0
- package/dist/nodes/ArubaClearPass/types/EnforcementProfile/EnforcementProfile.types.d.ts +131 -0
- package/dist/nodes/ArubaClearPass/types/EnforcementProfile/EnforcementProfile.types.js +2 -0
- package/dist/nodes/ArubaClearPass/types/Identities/Device.types.d.ts +55 -0
- package/dist/nodes/ArubaClearPass/types/Identities/Device.types.js +2 -0
- package/dist/nodes/ArubaClearPass/types/Identities/Endpoint.types.d.ts +12 -0
- package/dist/nodes/ArubaClearPass/types/Identities/Endpoint.types.js +2 -0
- package/dist/nodes/ArubaClearPass/types/Identities/GuestUser.types.d.ts +31 -0
- package/dist/nodes/ArubaClearPass/types/Identities/GuestUser.types.js +2 -0
- package/dist/nodes/ArubaClearPass/types/Identities/LocalUser.types.d.ts +51 -0
- package/dist/nodes/ArubaClearPass/types/Identities/LocalUser.types.js +2 -0
- package/dist/nodes/ArubaClearPass/types/PolicyElements/EnforcementPolicy.types.d.ts +37 -0
- package/dist/nodes/ArubaClearPass/types/PolicyElements/EnforcementPolicy.types.js +2 -0
- package/dist/nodes/ArubaClearPass/types/PolicyElements/Role.types.d.ts +15 -0
- package/dist/nodes/ArubaClearPass/types/PolicyElements/Role.types.js +2 -0
- package/dist/nodes/ArubaClearPass/types/PolicyElements/RoleMapping.types.d.ts +63 -0
- package/dist/nodes/ArubaClearPass/types/PolicyElements/RoleMapping.types.js +2 -0
- package/package.json +72 -0
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listLocalUsers = listLocalUsers;
|
|
4
|
+
exports.getLocalUser = getLocalUser;
|
|
5
|
+
exports.getLocalUserByUserId = getLocalUserByUserId;
|
|
6
|
+
exports.createLocalUser = createLocalUser;
|
|
7
|
+
exports.updateLocalUser = updateLocalUser;
|
|
8
|
+
exports.updateLocalUserByUserId = updateLocalUserByUserId;
|
|
9
|
+
exports.replaceLocalUser = replaceLocalUser;
|
|
10
|
+
exports.replaceLocalUserByUserId = replaceLocalUserByUserId;
|
|
11
|
+
exports.deleteLocalUser = deleteLocalUser;
|
|
12
|
+
exports.deleteLocalUserByUserId = deleteLocalUserByUserId;
|
|
13
|
+
// methods/Identities/LocalUser.methods.ts
|
|
14
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
15
|
+
const apiRequest_1 = require("../../helpers/apiRequest");
|
|
16
|
+
const responseFormatter_1 = require("../../helpers/responseFormatter");
|
|
17
|
+
/**
|
|
18
|
+
* Get a list of all local users
|
|
19
|
+
*/
|
|
20
|
+
async function listLocalUsers() {
|
|
21
|
+
try {
|
|
22
|
+
const returnAll = this.getNodeParameter('returnAll', 0);
|
|
23
|
+
const filters = this.getNodeParameter('filters', 0, {});
|
|
24
|
+
const endpoint = '/local-user';
|
|
25
|
+
let responseData;
|
|
26
|
+
if (returnAll) {
|
|
27
|
+
responseData = await apiRequest_1.apiRequestAllItems.call(this, 'GET', endpoint, {}, filters);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
const limit = this.getNodeParameter('limit', 0);
|
|
31
|
+
if (!filters.limit) {
|
|
32
|
+
filters.limit = limit;
|
|
33
|
+
}
|
|
34
|
+
responseData = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, filters);
|
|
35
|
+
}
|
|
36
|
+
return responseFormatter_1.formatResponse.call(this, responseData);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
const errorObject = {};
|
|
40
|
+
if (error instanceof Error) {
|
|
41
|
+
errorObject.message = error.message;
|
|
42
|
+
if (error.stack) {
|
|
43
|
+
errorObject.stackTrace = error.stack;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
errorObject.message = 'Unknown error in listLocalUsers';
|
|
48
|
+
}
|
|
49
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), errorObject);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Get a local user by ID
|
|
54
|
+
*/
|
|
55
|
+
async function getLocalUser() {
|
|
56
|
+
try {
|
|
57
|
+
const localUserId = this.getNodeParameter('localUserId', 0);
|
|
58
|
+
const endpoint = `/local-user/${localUserId}`;
|
|
59
|
+
const responseData = await apiRequest_1.apiRequest.call(this, 'GET', endpoint);
|
|
60
|
+
return responseFormatter_1.formatResponse.call(this, responseData);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
const errorObject = {};
|
|
64
|
+
if (error instanceof Error) {
|
|
65
|
+
errorObject.message = error.message;
|
|
66
|
+
if (error.stack) {
|
|
67
|
+
errorObject.stackTrace = error.stack;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
errorObject.message = 'Unknown error in getLocalUser';
|
|
72
|
+
}
|
|
73
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), errorObject);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Get a local user by User ID
|
|
78
|
+
*/
|
|
79
|
+
async function getLocalUserByUserId() {
|
|
80
|
+
try {
|
|
81
|
+
const userId = this.getNodeParameter('userId', 0);
|
|
82
|
+
const endpoint = `/local-user/user-id/${encodeURIComponent(userId)}`;
|
|
83
|
+
const responseData = await apiRequest_1.apiRequest.call(this, 'GET', endpoint);
|
|
84
|
+
return responseFormatter_1.formatResponse.call(this, responseData);
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
const errorObject = {};
|
|
88
|
+
if (error instanceof Error) {
|
|
89
|
+
errorObject.message = error.message;
|
|
90
|
+
if (error.stack) {
|
|
91
|
+
errorObject.stackTrace = error.stack;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
errorObject.message = 'Unknown error in getLocalUserByUserId';
|
|
96
|
+
}
|
|
97
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), errorObject);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Create a new local user
|
|
102
|
+
*/
|
|
103
|
+
async function createLocalUser() {
|
|
104
|
+
try {
|
|
105
|
+
const body = {};
|
|
106
|
+
// Add required fields
|
|
107
|
+
body.user_id = this.getNodeParameter('userId', 0);
|
|
108
|
+
body.password = this.getNodeParameter('password', 0);
|
|
109
|
+
body.username = this.getNodeParameter('username', 0);
|
|
110
|
+
body.role_name = this.getNodeParameter('roleName', 0);
|
|
111
|
+
// Add optional fields from additionalFields
|
|
112
|
+
const additionalFields = this.getNodeParameter('additionalFields', 0, {});
|
|
113
|
+
if (additionalFields.enabled !== undefined) {
|
|
114
|
+
body.enabled = additionalFields.enabled;
|
|
115
|
+
}
|
|
116
|
+
if (additionalFields.change_pwd_next_login !== undefined) {
|
|
117
|
+
body.change_pwd_next_login = additionalFields.change_pwd_next_login;
|
|
118
|
+
}
|
|
119
|
+
if (additionalFields.attributes) {
|
|
120
|
+
try {
|
|
121
|
+
const attributesJson = additionalFields.attributes;
|
|
122
|
+
body.attributes = JSON.parse(attributesJson);
|
|
123
|
+
}
|
|
124
|
+
catch (jsonError) {
|
|
125
|
+
const errorObject = {};
|
|
126
|
+
errorObject.message = `Invalid JSON in attributes: ${jsonError.message}`;
|
|
127
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), errorObject);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
const endpoint = '/local-user';
|
|
131
|
+
const responseData = await apiRequest_1.apiRequest.call(this, 'POST', endpoint, body);
|
|
132
|
+
return responseFormatter_1.formatResponse.call(this, responseData);
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
const errorObject = {};
|
|
136
|
+
if (error instanceof Error) {
|
|
137
|
+
errorObject.message = error.message;
|
|
138
|
+
if (error.stack) {
|
|
139
|
+
errorObject.stackTrace = error.stack;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
errorObject.message = 'Unknown error in createLocalUser';
|
|
144
|
+
}
|
|
145
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), errorObject);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Update a local user
|
|
150
|
+
*/
|
|
151
|
+
async function updateLocalUser() {
|
|
152
|
+
try {
|
|
153
|
+
const localUserId = this.getNodeParameter('localUserId', 0);
|
|
154
|
+
const body = {};
|
|
155
|
+
// Get update fields
|
|
156
|
+
const updateFields = this.getNodeParameter('updateFields', 0, {});
|
|
157
|
+
// Map update fields to body
|
|
158
|
+
if (updateFields.user_id)
|
|
159
|
+
body.user_id = updateFields.user_id;
|
|
160
|
+
if (updateFields.password)
|
|
161
|
+
body.password = updateFields.password;
|
|
162
|
+
if (updateFields.username)
|
|
163
|
+
body.username = updateFields.username;
|
|
164
|
+
if (updateFields.role_name)
|
|
165
|
+
body.role_name = updateFields.role_name;
|
|
166
|
+
// Add optional fields from additionalFields
|
|
167
|
+
const additionalFields = this.getNodeParameter('additionalFields', 0, {});
|
|
168
|
+
if (additionalFields.enabled !== undefined) {
|
|
169
|
+
body.enabled = additionalFields.enabled;
|
|
170
|
+
}
|
|
171
|
+
if (additionalFields.change_pwd_next_login !== undefined) {
|
|
172
|
+
body.change_pwd_next_login = additionalFields.change_pwd_next_login;
|
|
173
|
+
}
|
|
174
|
+
if (additionalFields.attributes) {
|
|
175
|
+
try {
|
|
176
|
+
const attributesJson = additionalFields.attributes;
|
|
177
|
+
body.attributes = JSON.parse(attributesJson);
|
|
178
|
+
}
|
|
179
|
+
catch (jsonError) {
|
|
180
|
+
const errorObject = {};
|
|
181
|
+
errorObject.message = `Invalid JSON in attributes: ${jsonError.message}`;
|
|
182
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), errorObject);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
const endpoint = `/local-user/${localUserId}`;
|
|
186
|
+
const responseData = await apiRequest_1.apiRequest.call(this, 'PATCH', endpoint, body);
|
|
187
|
+
return responseFormatter_1.formatResponse.call(this, responseData);
|
|
188
|
+
}
|
|
189
|
+
catch (error) {
|
|
190
|
+
const errorObject = {};
|
|
191
|
+
if (error instanceof Error) {
|
|
192
|
+
errorObject.message = error.message;
|
|
193
|
+
if (error.stack) {
|
|
194
|
+
errorObject.stackTrace = error.stack;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
errorObject.message = 'Unknown error in updateLocalUser';
|
|
199
|
+
}
|
|
200
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), errorObject);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Update a local user by User ID
|
|
205
|
+
*/
|
|
206
|
+
async function updateLocalUserByUserId() {
|
|
207
|
+
try {
|
|
208
|
+
const userId = this.getNodeParameter('userId', 0);
|
|
209
|
+
const body = {};
|
|
210
|
+
// Get update fields
|
|
211
|
+
const updateFields = this.getNodeParameter('updateFields', 0, {});
|
|
212
|
+
// Map update fields to body
|
|
213
|
+
if (updateFields.user_id)
|
|
214
|
+
body.user_id = updateFields.user_id;
|
|
215
|
+
if (updateFields.password)
|
|
216
|
+
body.password = updateFields.password;
|
|
217
|
+
if (updateFields.username)
|
|
218
|
+
body.username = updateFields.username;
|
|
219
|
+
if (updateFields.role_name)
|
|
220
|
+
body.role_name = updateFields.role_name;
|
|
221
|
+
// Add optional fields from additionalFields
|
|
222
|
+
const additionalFields = this.getNodeParameter('additionalFields', 0, {});
|
|
223
|
+
if (additionalFields.enabled !== undefined) {
|
|
224
|
+
body.enabled = additionalFields.enabled;
|
|
225
|
+
}
|
|
226
|
+
if (additionalFields.change_pwd_next_login !== undefined) {
|
|
227
|
+
body.change_pwd_next_login = additionalFields.change_pwd_next_login;
|
|
228
|
+
}
|
|
229
|
+
if (additionalFields.attributes) {
|
|
230
|
+
try {
|
|
231
|
+
const attributesJson = additionalFields.attributes;
|
|
232
|
+
body.attributes = JSON.parse(attributesJson);
|
|
233
|
+
}
|
|
234
|
+
catch (jsonError) {
|
|
235
|
+
const errorObject = {};
|
|
236
|
+
errorObject.message = `Invalid JSON in attributes: ${jsonError.message}`;
|
|
237
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), errorObject);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
const endpoint = `/local-user/user-id/${encodeURIComponent(userId)}`;
|
|
241
|
+
const responseData = await apiRequest_1.apiRequest.call(this, 'PATCH', endpoint, body);
|
|
242
|
+
return responseFormatter_1.formatResponse.call(this, responseData);
|
|
243
|
+
}
|
|
244
|
+
catch (error) {
|
|
245
|
+
const errorObject = {};
|
|
246
|
+
if (error instanceof Error) {
|
|
247
|
+
errorObject.message = error.message;
|
|
248
|
+
if (error.stack) {
|
|
249
|
+
errorObject.stackTrace = error.stack;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
errorObject.message = 'Unknown error in updateLocalUserByUserId';
|
|
254
|
+
}
|
|
255
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), errorObject);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Replace a local user
|
|
260
|
+
*/
|
|
261
|
+
async function replaceLocalUser() {
|
|
262
|
+
try {
|
|
263
|
+
const localUserId = this.getNodeParameter('localUserId', 0);
|
|
264
|
+
const body = {};
|
|
265
|
+
// Add required fields
|
|
266
|
+
body.user_id = this.getNodeParameter('userId', 0);
|
|
267
|
+
body.password = this.getNodeParameter('password', 0);
|
|
268
|
+
body.username = this.getNodeParameter('username', 0);
|
|
269
|
+
body.role_name = this.getNodeParameter('roleName', 0);
|
|
270
|
+
// Add optional fields from additionalFields
|
|
271
|
+
const additionalFields = this.getNodeParameter('additionalFields', 0, {});
|
|
272
|
+
if (additionalFields.enabled !== undefined) {
|
|
273
|
+
body.enabled = additionalFields.enabled;
|
|
274
|
+
}
|
|
275
|
+
if (additionalFields.change_pwd_next_login !== undefined) {
|
|
276
|
+
body.change_pwd_next_login = additionalFields.change_pwd_next_login;
|
|
277
|
+
}
|
|
278
|
+
if (additionalFields.attributes) {
|
|
279
|
+
try {
|
|
280
|
+
const attributesJson = additionalFields.attributes;
|
|
281
|
+
body.attributes = JSON.parse(attributesJson);
|
|
282
|
+
}
|
|
283
|
+
catch (jsonError) {
|
|
284
|
+
const errorObject = {};
|
|
285
|
+
errorObject.message = `Invalid JSON in attributes: ${jsonError.message}`;
|
|
286
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), errorObject);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
const endpoint = `/local-user/${localUserId}`;
|
|
290
|
+
const responseData = await apiRequest_1.apiRequest.call(this, 'PUT', endpoint, body);
|
|
291
|
+
return responseFormatter_1.formatResponse.call(this, responseData);
|
|
292
|
+
}
|
|
293
|
+
catch (error) {
|
|
294
|
+
const errorObject = {};
|
|
295
|
+
if (error instanceof Error) {
|
|
296
|
+
errorObject.message = error.message;
|
|
297
|
+
if (error.stack) {
|
|
298
|
+
errorObject.stackTrace = error.stack;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
errorObject.message = 'Unknown error in replaceLocalUser';
|
|
303
|
+
}
|
|
304
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), errorObject);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Replace a local user by User ID
|
|
309
|
+
*/
|
|
310
|
+
async function replaceLocalUserByUserId() {
|
|
311
|
+
try {
|
|
312
|
+
const userId = this.getNodeParameter('userId', 0);
|
|
313
|
+
const body = {};
|
|
314
|
+
// Add required fields
|
|
315
|
+
body.user_id = this.getNodeParameter('userId', 0);
|
|
316
|
+
body.password = this.getNodeParameter('password', 0);
|
|
317
|
+
body.username = this.getNodeParameter('username', 0);
|
|
318
|
+
body.role_name = this.getNodeParameter('roleName', 0);
|
|
319
|
+
// Add optional fields from additionalFields
|
|
320
|
+
const additionalFields = this.getNodeParameter('additionalFields', 0, {});
|
|
321
|
+
if (additionalFields.enabled !== undefined) {
|
|
322
|
+
body.enabled = additionalFields.enabled;
|
|
323
|
+
}
|
|
324
|
+
if (additionalFields.change_pwd_next_login !== undefined) {
|
|
325
|
+
body.change_pwd_next_login = additionalFields.change_pwd_next_login;
|
|
326
|
+
}
|
|
327
|
+
if (additionalFields.attributes) {
|
|
328
|
+
try {
|
|
329
|
+
const attributesJson = additionalFields.attributes;
|
|
330
|
+
body.attributes = JSON.parse(attributesJson);
|
|
331
|
+
}
|
|
332
|
+
catch (jsonError) {
|
|
333
|
+
const errorObject = {};
|
|
334
|
+
errorObject.message = `Invalid JSON in attributes: ${jsonError.message}`;
|
|
335
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), errorObject);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
const endpoint = `/local-user/user-id/${encodeURIComponent(userId)}`;
|
|
339
|
+
const responseData = await apiRequest_1.apiRequest.call(this, 'PUT', endpoint, body);
|
|
340
|
+
return responseFormatter_1.formatResponse.call(this, responseData);
|
|
341
|
+
}
|
|
342
|
+
catch (error) {
|
|
343
|
+
const errorObject = {};
|
|
344
|
+
if (error instanceof Error) {
|
|
345
|
+
errorObject.message = error.message;
|
|
346
|
+
if (error.stack) {
|
|
347
|
+
errorObject.stackTrace = error.stack;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
else {
|
|
351
|
+
errorObject.message = 'Unknown error in replaceLocalUserByUserId';
|
|
352
|
+
}
|
|
353
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), errorObject);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Delete a local user
|
|
358
|
+
*/
|
|
359
|
+
async function deleteLocalUser() {
|
|
360
|
+
try {
|
|
361
|
+
const localUserId = this.getNodeParameter('localUserId', 0);
|
|
362
|
+
const endpoint = `/local-user/${localUserId}`;
|
|
363
|
+
await apiRequest_1.apiRequest.call(this, 'DELETE', endpoint);
|
|
364
|
+
return [
|
|
365
|
+
{ json: { success: true, message: `Local User with ID ${localUserId} has been deleted` } },
|
|
366
|
+
];
|
|
367
|
+
}
|
|
368
|
+
catch (error) {
|
|
369
|
+
const errorObject = {};
|
|
370
|
+
if (error instanceof Error) {
|
|
371
|
+
errorObject.message = error.message;
|
|
372
|
+
if (error.stack) {
|
|
373
|
+
errorObject.stackTrace = error.stack;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
else {
|
|
377
|
+
errorObject.message = 'Unknown error in deleteLocalUser';
|
|
378
|
+
}
|
|
379
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), errorObject);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Delete a local user by User ID
|
|
384
|
+
*/
|
|
385
|
+
async function deleteLocalUserByUserId() {
|
|
386
|
+
try {
|
|
387
|
+
const userId = this.getNodeParameter('userId', 0);
|
|
388
|
+
const endpoint = `/local-user/user-id/${encodeURIComponent(userId)}`;
|
|
389
|
+
await apiRequest_1.apiRequest.call(this, 'DELETE', endpoint);
|
|
390
|
+
return [
|
|
391
|
+
{ json: { success: true, message: `Local User with User ID ${userId} has been deleted` } },
|
|
392
|
+
];
|
|
393
|
+
}
|
|
394
|
+
catch (error) {
|
|
395
|
+
const errorObject = {};
|
|
396
|
+
if (error instanceof Error) {
|
|
397
|
+
errorObject.message = error.message;
|
|
398
|
+
if (error.stack) {
|
|
399
|
+
errorObject.stackTrace = error.stack;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
else {
|
|
403
|
+
errorObject.message = 'Unknown error in deleteLocalUserByUserId';
|
|
404
|
+
}
|
|
405
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), errorObject);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
|
2
|
+
/**
|
|
3
|
+
* List all enforcement policies
|
|
4
|
+
*/
|
|
5
|
+
export declare function listEnforcementPolicies(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
|
|
6
|
+
/**
|
|
7
|
+
* Get an enforcement policy by ID
|
|
8
|
+
*/
|
|
9
|
+
export declare function getEnforcementPolicy(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Get an enforcement policy by name
|
|
12
|
+
*/
|
|
13
|
+
export declare function getEnforcementPolicyByName(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Create a new enforcement policy
|
|
16
|
+
*/
|
|
17
|
+
export declare function createEnforcementPolicy(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Update an enforcement policy by ID
|
|
20
|
+
*/
|
|
21
|
+
export declare function updateEnforcementPolicy(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Update an enforcement policy by name
|
|
24
|
+
*/
|
|
25
|
+
export declare function updateEnforcementPolicyByName(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Replace an enforcement policy by ID
|
|
28
|
+
*/
|
|
29
|
+
export declare function replaceEnforcementPolicy(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Replace an enforcement policy by name
|
|
32
|
+
*/
|
|
33
|
+
export declare function replaceEnforcementPolicyByName(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
|
|
34
|
+
/**
|
|
35
|
+
* Delete an enforcement policy by ID
|
|
36
|
+
*/
|
|
37
|
+
export declare function deleteEnforcementPolicy(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Delete an enforcement policy by name
|
|
40
|
+
*/
|
|
41
|
+
export declare function deleteEnforcementPolicyByName(this: IExecuteFunctions): Promise<INodeExecutionData[]>;
|