@northern.tech/testing 0.7.1 → 0.8.1
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 +3 -4
- package/dist/baseTestConfig.json +0 -17
- package/dist/chunk-4UV4MWUU.js +0 -188
- package/dist/chunk-4UV4MWUU.js.map +0 -1
- package/dist/chunk-5GIOT4M6.js +0 -161
- package/dist/chunk-5GIOT4M6.js.map +0 -1
- package/dist/chunk-AQYKNNMJ.js +0 -239
- package/dist/chunk-AQYKNNMJ.js.map +0 -1
- package/dist/chunk-CT35JRBC.js +0 -893
- package/dist/chunk-CT35JRBC.js.map +0 -1
- package/dist/chunk-HRGVXWMH.js +0 -17
- package/dist/chunk-HRGVXWMH.js.map +0 -1
- package/dist/chunk-RG3ICJW5.js +0 -34
- package/dist/chunk-RG3ICJW5.js.map +0 -1
- package/dist/chunk-ROSMRKMF.js +0 -265
- package/dist/chunk-ROSMRKMF.js.map +0 -1
- package/dist/chunk-TVJ6K2KG.js +0 -318
- package/dist/chunk-TVJ6K2KG.js.map +0 -1
- package/dist/chunk-WFNPT672.js +0 -29
- package/dist/chunk-WFNPT672.js.map +0 -1
- package/dist/mockData.cjs +0 -926
- package/dist/mockData.cjs.map +0 -1
- package/dist/mockData.d.cts +0 -596
- package/dist/mockData.d.ts +0 -596
- package/dist/mockData.js +0 -45
- package/dist/mockData.js.map +0 -1
- package/dist/requestHandlers/deploymentHandlers.cjs +0 -1045
- package/dist/requestHandlers/deploymentHandlers.cjs.map +0 -1
- package/dist/requestHandlers/deploymentHandlers.d.cts +0 -5
- package/dist/requestHandlers/deploymentHandlers.d.ts +0 -5
- package/dist/requestHandlers/deploymentHandlers.js +0 -8
- package/dist/requestHandlers/deploymentHandlers.js.map +0 -1
- package/dist/requestHandlers/deviceHandlers.cjs +0 -1113
- package/dist/requestHandlers/deviceHandlers.cjs.map +0 -1
- package/dist/requestHandlers/deviceHandlers.d.cts +0 -20
- package/dist/requestHandlers/deviceHandlers.d.ts +0 -20
- package/dist/requestHandlers/deviceHandlers.js +0 -12
- package/dist/requestHandlers/deviceHandlers.js.map +0 -1
- package/dist/requestHandlers/monitorHandlers.cjs +0 -835
- package/dist/requestHandlers/monitorHandlers.cjs.map +0 -1
- package/dist/requestHandlers/monitorHandlers.d.cts +0 -5
- package/dist/requestHandlers/monitorHandlers.d.ts +0 -5
- package/dist/requestHandlers/monitorHandlers.js +0 -8
- package/dist/requestHandlers/monitorHandlers.js.map +0 -1
- package/dist/requestHandlers/organizationHandlers.cjs +0 -1086
- package/dist/requestHandlers/organizationHandlers.cjs.map +0 -1
- package/dist/requestHandlers/organizationHandlers.d.cts +0 -5
- package/dist/requestHandlers/organizationHandlers.d.ts +0 -5
- package/dist/requestHandlers/organizationHandlers.js +0 -8
- package/dist/requestHandlers/organizationHandlers.js.map +0 -1
- package/dist/requestHandlers/releaseHandlers.cjs +0 -966
- package/dist/requestHandlers/releaseHandlers.cjs.map +0 -1
- package/dist/requestHandlers/releaseHandlers.d.cts +0 -5
- package/dist/requestHandlers/releaseHandlers.d.ts +0 -5
- package/dist/requestHandlers/releaseHandlers.js +0 -8
- package/dist/requestHandlers/releaseHandlers.js.map +0 -1
- package/dist/requestHandlers/requestHandlers.cjs +0 -1975
- package/dist/requestHandlers/requestHandlers.cjs.map +0 -1
- package/dist/requestHandlers/requestHandlers.d.cts +0 -5
- package/dist/requestHandlers/requestHandlers.d.ts +0 -5
- package/dist/requestHandlers/requestHandlers.js +0 -35
- package/dist/requestHandlers/requestHandlers.js.map +0 -1
- package/dist/requestHandlers/userHandlers.cjs +0 -994
- package/dist/requestHandlers/userHandlers.cjs.map +0 -1
- package/dist/requestHandlers/userHandlers.d.cts +0 -5
- package/dist/requestHandlers/userHandlers.d.ts +0 -5
- package/dist/requestHandlers/userHandlers.js +0 -8
- package/dist/requestHandlers/userHandlers.js.map +0 -1
- package/dist/setupTests.cjs +0 -996
- package/dist/setupTests.cjs.map +0 -1
- package/dist/setupTests.d.cts +0 -77
- package/dist/setupTests.d.ts +0 -77
- package/dist/setupTests.js +0 -138
- package/dist/setupTests.js.map +0 -1
- package/dist/theme/light.cjs +0 -41
- package/dist/theme/light.cjs.map +0 -1
- package/dist/theme/light.d.cts +0 -12
- package/dist/theme/light.d.ts +0 -12
- package/dist/theme/light.js +0 -7
- package/dist/theme/light.js.map +0 -1
- package/dist/utils.cjs +0 -71
- package/dist/utils.cjs.map +0 -1
- package/dist/utils.d.cts +0 -69
- package/dist/utils.d.ts +0 -69
- package/dist/utils.js +0 -12
- package/dist/utils.js.map +0 -1
|
@@ -1,1086 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/requestHandlers/organizationHandlers.ts
|
|
21
|
-
var organizationHandlers_exports = {};
|
|
22
|
-
__export(organizationHandlers_exports, {
|
|
23
|
-
organizationHandlers: () => organizationHandlers
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(organizationHandlers_exports);
|
|
26
|
-
var import_constants2 = require("@northern.tech/utils/constants");
|
|
27
|
-
var import_msw = require("msw");
|
|
28
|
-
|
|
29
|
-
// src/mockData.ts
|
|
30
|
-
var import_constants = require("@northern.tech/utils/constants");
|
|
31
|
-
var TEST_SESSION_DATETIME = "2019-01-13T13:00:00.000Z";
|
|
32
|
-
var testDate = new Date(TEST_SESSION_DATETIME);
|
|
33
|
-
var mockDate = new Date(testDate.setMilliseconds(testDate.getMilliseconds() + import_constants.maxSessionAge));
|
|
34
|
-
var defaultCreationDate = "2019-01-13T06:25:00.000Z";
|
|
35
|
-
var defaultMacAddress = "dc:a6:32:12:ad:bf";
|
|
36
|
-
var permissionSetObjectTypes = {
|
|
37
|
-
any: "Any",
|
|
38
|
-
artifacts: "Artifacts",
|
|
39
|
-
empty: "",
|
|
40
|
-
groups: "Device groups",
|
|
41
|
-
releases: "Releases",
|
|
42
|
-
tenantManagement: "Tenant management",
|
|
43
|
-
userManagement: "User management"
|
|
44
|
-
};
|
|
45
|
-
var commonEndpoints = {
|
|
46
|
-
artifacts: "^/api/management/v1/deployments/artifacts",
|
|
47
|
-
artifactDetails: "^/api/management/v1/deployments/artifacts/[^/]+",
|
|
48
|
-
deviceManagement: "^/api/management/(v[1-9])/(devauth|inventory)/"
|
|
49
|
-
};
|
|
50
|
-
var webhookEvents = [
|
|
51
|
-
{
|
|
52
|
-
id: "1",
|
|
53
|
-
type: "device-status-changed",
|
|
54
|
-
data: { id: "1", status: "accepted" },
|
|
55
|
-
time: "2020-09-01T12:00:00.000Z",
|
|
56
|
-
delivery_statuses: [{ integration_id: "1", success: true, status_code: 200 }]
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
id: "2",
|
|
60
|
-
type: "device-status-changed",
|
|
61
|
-
data: { id: "3", status: "accepted" },
|
|
62
|
-
time: "2020-09-01T12:00:05.000Z",
|
|
63
|
-
delivery_statuses: [{ integration_id: "1", success: true, status_code: 200 }]
|
|
64
|
-
}
|
|
65
|
-
];
|
|
66
|
-
var userId = "a30a780b-b843-5344-80e3-0fd95a4f6fc3";
|
|
67
|
-
var defaultUser = {
|
|
68
|
-
created_ts: "2019-01-01T10:30:00.000Z",
|
|
69
|
-
email: "a@b.com",
|
|
70
|
-
id: "a1",
|
|
71
|
-
roles: ["RBAC_ROLE_PERMIT_ALL"],
|
|
72
|
-
tfa_status: "enabled",
|
|
73
|
-
verified: true
|
|
74
|
-
};
|
|
75
|
-
var deviceTypes = { qemu: "qemux86-64" };
|
|
76
|
-
var checkInTimeRounded = "2019-01-01T00:00:00.000Z";
|
|
77
|
-
var checkInTimeExact = "2019-01-01T10:25:00.000Z";
|
|
78
|
-
var mockApiResponses = {
|
|
79
|
-
deployments: {
|
|
80
|
-
byId: {
|
|
81
|
-
d1: {
|
|
82
|
-
id: "d1",
|
|
83
|
-
name: "test deployment",
|
|
84
|
-
created: "2019-01-01T12:30:00.000Z",
|
|
85
|
-
devices: {
|
|
86
|
-
a1: {
|
|
87
|
-
id: "a1",
|
|
88
|
-
status: "installing",
|
|
89
|
-
attributes: {},
|
|
90
|
-
image: { size: 123 }
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
statistics: {
|
|
94
|
-
status: {
|
|
95
|
-
"already-installed": 0,
|
|
96
|
-
decommissioned: 0,
|
|
97
|
-
downloading: 0,
|
|
98
|
-
failure: 0,
|
|
99
|
-
installing: 1,
|
|
100
|
-
noartifact: 0,
|
|
101
|
-
pending: 0,
|
|
102
|
-
rebooting: 0,
|
|
103
|
-
success: 0
|
|
104
|
-
},
|
|
105
|
-
total_size: 1234
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
d2: {
|
|
109
|
-
id: "d2",
|
|
110
|
-
name: "test deployment 2",
|
|
111
|
-
artifact_name: "r1",
|
|
112
|
-
artifacts: ["123"],
|
|
113
|
-
created: "2019-01-01T12:25:00.000Z",
|
|
114
|
-
device_count: 1,
|
|
115
|
-
devices: {
|
|
116
|
-
b1: {
|
|
117
|
-
attributes: {},
|
|
118
|
-
id: "b1",
|
|
119
|
-
status: "pending"
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
filter: void 0,
|
|
123
|
-
group: void 0,
|
|
124
|
-
statistics: {
|
|
125
|
-
status: {
|
|
126
|
-
downloading: 0,
|
|
127
|
-
decommissioned: 0,
|
|
128
|
-
failure: 0,
|
|
129
|
-
installing: 0,
|
|
130
|
-
noartifact: 0,
|
|
131
|
-
pending: 1,
|
|
132
|
-
rebooting: 0,
|
|
133
|
-
success: 0,
|
|
134
|
-
"already-installed": 0
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
d3: {
|
|
139
|
-
id: "d3",
|
|
140
|
-
name: "Test",
|
|
141
|
-
phases: [
|
|
142
|
-
{ id: "0", batch_size: 2, device_count: 2 },
|
|
143
|
-
{ id: "1", start_ts: "2019-02-04T11:45:10.002Z", batch_size: 3, device_count: 3 },
|
|
144
|
-
{ id: "2", start_ts: "2019-02-05T11:45:10.002Z", batch_size: 5, device_count: 5 },
|
|
145
|
-
{ id: "3", start_ts: "2019-02-06T11:45:10.002Z", batch_size: 5, device_count: 5 },
|
|
146
|
-
{ id: "4", start_ts: "2019-02-21T11:45:10.002Z", batch_size: 5, device_count: 0 }
|
|
147
|
-
],
|
|
148
|
-
max_devices: 0,
|
|
149
|
-
created: "2019-01-31T12:59:30.020Z",
|
|
150
|
-
devices: {},
|
|
151
|
-
filter: void 0,
|
|
152
|
-
group: void 0,
|
|
153
|
-
stats: {
|
|
154
|
-
pending: 3,
|
|
155
|
-
decommissioned: 0,
|
|
156
|
-
failure: 23,
|
|
157
|
-
pause_before_committing: 0,
|
|
158
|
-
pause_before_rebooting: 0,
|
|
159
|
-
installing: 0,
|
|
160
|
-
rebooting: 0,
|
|
161
|
-
"already-installed": 0,
|
|
162
|
-
pause_before_installing: 0,
|
|
163
|
-
downloading: 0,
|
|
164
|
-
success: 6,
|
|
165
|
-
aborted: 0,
|
|
166
|
-
noartifact: 0
|
|
167
|
-
},
|
|
168
|
-
statistics: { total_size: "1234" },
|
|
169
|
-
status: "inprogress",
|
|
170
|
-
active: true,
|
|
171
|
-
device_count: 100,
|
|
172
|
-
retries: "0",
|
|
173
|
-
type: "software"
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
byStatus: {
|
|
177
|
-
pending: { deploymentIds: ["d2"] },
|
|
178
|
-
inprogress: { deploymentIds: ["d3"] }
|
|
179
|
-
}
|
|
180
|
-
},
|
|
181
|
-
devices: {
|
|
182
|
-
byId: {
|
|
183
|
-
a1: {
|
|
184
|
-
id: "a1",
|
|
185
|
-
auth_sets: [
|
|
186
|
-
{
|
|
187
|
-
id: "auth1",
|
|
188
|
-
identity_data: { mac: defaultMacAddress },
|
|
189
|
-
pubkey: "-----BEGIN PUBLIC KEY-----\nMIIBojWELzgJ62hcXIhAfqfoNiaB1326XZByZwcnHr5BuSPAgMBAAE=\n-----END PUBLIC KEY-----\n",
|
|
190
|
-
status: "accepted",
|
|
191
|
-
ts: defaultCreationDate
|
|
192
|
-
}
|
|
193
|
-
],
|
|
194
|
-
updated_ts: "2019-01-01T09:25:00.000Z"
|
|
195
|
-
},
|
|
196
|
-
b1: {
|
|
197
|
-
id: "b1",
|
|
198
|
-
attributes: {
|
|
199
|
-
ipv4_wlan0: "192.168.10.141/24",
|
|
200
|
-
device_type: [deviceTypes.qemu]
|
|
201
|
-
},
|
|
202
|
-
system: {
|
|
203
|
-
check_in_time: checkInTimeRounded
|
|
204
|
-
},
|
|
205
|
-
check_in_time: checkInTimeExact,
|
|
206
|
-
check_in_time_exact: checkInTimeExact,
|
|
207
|
-
check_in_time_rounded: checkInTimeRounded,
|
|
208
|
-
identity_data: { mac: defaultMacAddress },
|
|
209
|
-
status: "accepted",
|
|
210
|
-
decommissioning: false,
|
|
211
|
-
created_ts: defaultCreationDate,
|
|
212
|
-
updated_ts: "2019-01-01T09:25:00.000Z",
|
|
213
|
-
auth_sets: [
|
|
214
|
-
{
|
|
215
|
-
id: "auth1",
|
|
216
|
-
identity_data: { mac: defaultMacAddress },
|
|
217
|
-
pubkey: "-----BEGIN PUBLIC KEY-----\nMIIBojWELzgJ62hcXIhAfqfoNiaB1326XZByZwcnHr5BuSPAgMBAAE=\n-----END PUBLIC KEY-----\n",
|
|
218
|
-
ts: defaultCreationDate,
|
|
219
|
-
status: "accepted"
|
|
220
|
-
}
|
|
221
|
-
]
|
|
222
|
-
}
|
|
223
|
-
},
|
|
224
|
-
groups: {
|
|
225
|
-
byId: {
|
|
226
|
-
testGroup: {
|
|
227
|
-
deviceIds: ["a1", "b1"],
|
|
228
|
-
filters: [],
|
|
229
|
-
total: 2
|
|
230
|
-
},
|
|
231
|
-
testGroupDynamic: {
|
|
232
|
-
id: "filter1",
|
|
233
|
-
name: "filter1",
|
|
234
|
-
filters: [{ scope: "system", key: "group", operator: "$eq", value: "things" }]
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
},
|
|
238
|
-
limits: { standard: 500, micro: 0, system: 0 },
|
|
239
|
-
byStatus: {
|
|
240
|
-
accepted: { deviceIds: ["a1", "b1"], total: 2 },
|
|
241
|
-
active: { deviceIds: [], total: 0 },
|
|
242
|
-
inactive: { deviceIds: [], total: 0 },
|
|
243
|
-
pending: { deviceIds: ["c1"], total: 1 },
|
|
244
|
-
preauthorized: { deviceIds: [], total: 0 },
|
|
245
|
-
rejected: { deviceIds: [], total: 0 }
|
|
246
|
-
}
|
|
247
|
-
},
|
|
248
|
-
organization: {
|
|
249
|
-
organization: {
|
|
250
|
-
id: "1",
|
|
251
|
-
addons: [],
|
|
252
|
-
name: "test",
|
|
253
|
-
plan: "os",
|
|
254
|
-
trial: false
|
|
255
|
-
},
|
|
256
|
-
products: [
|
|
257
|
-
{
|
|
258
|
-
name: "mender_standard",
|
|
259
|
-
billing_unit: "devices",
|
|
260
|
-
prices: [
|
|
261
|
-
{
|
|
262
|
-
plan: "os",
|
|
263
|
-
constraints: {
|
|
264
|
-
min: 50,
|
|
265
|
-
max: 1e3,
|
|
266
|
-
div: 50
|
|
267
|
-
}
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
plan: "professional",
|
|
271
|
-
constraints: {
|
|
272
|
-
min: 250,
|
|
273
|
-
max: 1e4,
|
|
274
|
-
div: 50
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
],
|
|
278
|
-
addons: [
|
|
279
|
-
{
|
|
280
|
-
name: "troubleshoot",
|
|
281
|
-
prices: [{ plan: "os" }, { plan: "professional" }]
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
name: "configure",
|
|
285
|
-
prices: [{ plan: "os" }, { plan: "professional" }]
|
|
286
|
-
},
|
|
287
|
-
{
|
|
288
|
-
name: "monitor",
|
|
289
|
-
prices: [{ plan: "professional" }]
|
|
290
|
-
}
|
|
291
|
-
]
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
name: "mender_micro",
|
|
295
|
-
billing_unit: "devices",
|
|
296
|
-
prices: [
|
|
297
|
-
{
|
|
298
|
-
plan: "os",
|
|
299
|
-
constraints: {
|
|
300
|
-
min: 50,
|
|
301
|
-
max: 5e3,
|
|
302
|
-
div: 50
|
|
303
|
-
}
|
|
304
|
-
},
|
|
305
|
-
{
|
|
306
|
-
plan: "professional",
|
|
307
|
-
constraints: {
|
|
308
|
-
min: 500,
|
|
309
|
-
max: 1e5,
|
|
310
|
-
div: 50
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
]
|
|
314
|
-
}
|
|
315
|
-
],
|
|
316
|
-
intentId: "testIntent",
|
|
317
|
-
auditlog: {
|
|
318
|
-
events: [
|
|
319
|
-
{
|
|
320
|
-
actor: {
|
|
321
|
-
id: "string",
|
|
322
|
-
type: "user",
|
|
323
|
-
email: "string@example.com"
|
|
324
|
-
},
|
|
325
|
-
time: "2019-01-01T12:10:22.667Z",
|
|
326
|
-
action: "create",
|
|
327
|
-
object: {
|
|
328
|
-
id: "string",
|
|
329
|
-
type: "user",
|
|
330
|
-
user: {
|
|
331
|
-
email: "user@acme.com"
|
|
332
|
-
}
|
|
333
|
-
},
|
|
334
|
-
change: "change1"
|
|
335
|
-
},
|
|
336
|
-
{
|
|
337
|
-
actor: {
|
|
338
|
-
id: "string",
|
|
339
|
-
type: "user",
|
|
340
|
-
email: "string",
|
|
341
|
-
identity_data: "string"
|
|
342
|
-
},
|
|
343
|
-
time: "2019-01-01T12:16:22.667Z",
|
|
344
|
-
action: "create",
|
|
345
|
-
object: {
|
|
346
|
-
id: "string",
|
|
347
|
-
type: "deployment",
|
|
348
|
-
deployment: {
|
|
349
|
-
name: "production",
|
|
350
|
-
artifact_name: "Application 0.0.1"
|
|
351
|
-
}
|
|
352
|
-
},
|
|
353
|
-
change: "change2"
|
|
354
|
-
},
|
|
355
|
-
{
|
|
356
|
-
actor: {
|
|
357
|
-
id: "string",
|
|
358
|
-
type: "user",
|
|
359
|
-
email: "string@example.com"
|
|
360
|
-
},
|
|
361
|
-
time: "2019-01-01T12:10:22.669Z",
|
|
362
|
-
action: "open_terminal",
|
|
363
|
-
meta: {
|
|
364
|
-
session_id: ["abd313a8-ee88-48ab-9c99-fbcd80048e6e"]
|
|
365
|
-
},
|
|
366
|
-
object: {
|
|
367
|
-
id: "a1",
|
|
368
|
-
type: "device"
|
|
369
|
-
},
|
|
370
|
-
change: "change3"
|
|
371
|
-
}
|
|
372
|
-
]
|
|
373
|
-
}
|
|
374
|
-
},
|
|
375
|
-
releases: {
|
|
376
|
-
byId: {
|
|
377
|
-
r1: {
|
|
378
|
-
name: "r1",
|
|
379
|
-
artifacts: [
|
|
380
|
-
{
|
|
381
|
-
id: "art1",
|
|
382
|
-
description: "test description",
|
|
383
|
-
device_types_compatible: [deviceTypes.qemu],
|
|
384
|
-
modified: "2020-09-10T12:16:22.667Z",
|
|
385
|
-
updates: [{ type_info: { type: "testtype" } }],
|
|
386
|
-
artifact_depends: {
|
|
387
|
-
device_type: [deviceTypes.qemu]
|
|
388
|
-
},
|
|
389
|
-
artifact_provides: {
|
|
390
|
-
artifact_name: "myapp",
|
|
391
|
-
"data-partition.myapp.version": "v2020.10",
|
|
392
|
-
list_of_fancy: [deviceTypes.qemu, "x172"]
|
|
393
|
-
},
|
|
394
|
-
clears_artifact_provides: ["data-partition.myapp.*"]
|
|
395
|
-
}
|
|
396
|
-
],
|
|
397
|
-
device_types_compatible: [deviceTypes.qemu],
|
|
398
|
-
modified: "2020-09-10T12:16:22.667Z",
|
|
399
|
-
metaData: {}
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
},
|
|
403
|
-
users: {
|
|
404
|
-
byId: {
|
|
405
|
-
a1: defaultUser,
|
|
406
|
-
[userId]: { ...defaultUser, id: userId, email: "a2@b.com", created_ts: "2019-01-01T12:30:00.000Z" }
|
|
407
|
-
},
|
|
408
|
-
rolesById: {
|
|
409
|
-
admin: {
|
|
410
|
-
name: "admin",
|
|
411
|
-
description: "Administrator role",
|
|
412
|
-
permissions: []
|
|
413
|
-
},
|
|
414
|
-
test: { name: "test", description: "test description", permissions: [] }
|
|
415
|
-
},
|
|
416
|
-
globalSettings: {
|
|
417
|
-
"2fa": "enabled",
|
|
418
|
-
id_attribute: void 0,
|
|
419
|
-
previousFilters: []
|
|
420
|
-
},
|
|
421
|
-
userSettings: {
|
|
422
|
-
"2fa": "disabled",
|
|
423
|
-
columnSelection: [],
|
|
424
|
-
onboarding: { something: "here" },
|
|
425
|
-
tooltips: {},
|
|
426
|
-
previousFilters: []
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
};
|
|
430
|
-
var releasesList = Array.from({ length: 5e3 }, (x, i) => ({
|
|
431
|
-
artifacts: [
|
|
432
|
-
{
|
|
433
|
-
id: "art1",
|
|
434
|
-
description: "test description",
|
|
435
|
-
device_types_compatible: [deviceTypes.qemu],
|
|
436
|
-
modified: "2020-09-10T12:16:22.667Z",
|
|
437
|
-
updates: [{ type_info: { type: "testtype" } }],
|
|
438
|
-
artifact_depends: {
|
|
439
|
-
device_type: [deviceTypes.qemu]
|
|
440
|
-
},
|
|
441
|
-
artifact_provides: {
|
|
442
|
-
artifact_name: "myapp",
|
|
443
|
-
"data-partition.myapp.version": "v2020.10",
|
|
444
|
-
list_of_fancy: [deviceTypes.qemu, "x172"]
|
|
445
|
-
},
|
|
446
|
-
clears_artifact_provides: ["data-partition.myapp.*"]
|
|
447
|
-
}
|
|
448
|
-
],
|
|
449
|
-
device_types_compatible: [deviceTypes.qemu],
|
|
450
|
-
metaData: {},
|
|
451
|
-
name: `release-${i + 1}`,
|
|
452
|
-
modified: i
|
|
453
|
-
}));
|
|
454
|
-
var permissionSets = [
|
|
455
|
-
{
|
|
456
|
-
...import_constants.defaultPermissionSets.Basic,
|
|
457
|
-
object: permissionSetObjectTypes.empty,
|
|
458
|
-
description: "Set containing basic permissions.",
|
|
459
|
-
permissions: [
|
|
460
|
-
{ action: "http", object: { type: "any", value: "^/api/management/v1/useradm/settings$" } },
|
|
461
|
-
{ action: "http", object: { type: "any", value: "^/api/management/v1/useradm/users/me$" } },
|
|
462
|
-
{ action: "http", object: { type: "any", value: "^/api/management/1.0/auth/verify$" } },
|
|
463
|
-
{ action: "http", object: { type: "PUT", value: "^/api/management/v1/useradm/2faverify$" } },
|
|
464
|
-
{ action: "http", object: { type: "POST", value: "^/api/management/v1/useradm/users/me/2fa/(enable|disable)$" } },
|
|
465
|
-
{ action: "http", object: { type: "GET", value: "^/api/management/(v[1-9])/useradm/roles" } },
|
|
466
|
-
{ action: "http", object: { type: "GET", value: "^/api/management/(v[1-9])/tenantadm/user/tenant" } }
|
|
467
|
-
]
|
|
468
|
-
},
|
|
469
|
-
{
|
|
470
|
-
...import_constants.defaultPermissionSets.ManageReleases,
|
|
471
|
-
action: import_constants.uiPermissionsById.manage.title,
|
|
472
|
-
object: permissionSetObjectTypes.releases,
|
|
473
|
-
description: "Set of permissions which allows user to manage releases",
|
|
474
|
-
permissions: [
|
|
475
|
-
{ action: "http", object: { type: "GET", value: commonEndpoints.artifacts } },
|
|
476
|
-
{ action: "http", object: { type: "GET", value: commonEndpoints.artifactDetails } },
|
|
477
|
-
{ action: "http", object: { type: "PUT", value: commonEndpoints.artifactDetails } },
|
|
478
|
-
{ action: "http", object: { type: "DELETE", value: commonEndpoints.artifactDetails } },
|
|
479
|
-
{ action: "http", object: { type: "GET", value: "^/api/management/v1/deployments/artifacts/[^/]+/download" } }
|
|
480
|
-
]
|
|
481
|
-
},
|
|
482
|
-
{
|
|
483
|
-
...import_constants.defaultPermissionSets.ReadUsers,
|
|
484
|
-
action: import_constants.uiPermissionsById.read.title,
|
|
485
|
-
object: permissionSetObjectTypes.userManagement,
|
|
486
|
-
description: "Set of permissions which allows user to view other users",
|
|
487
|
-
permissions: [{ action: "http", object: { type: "GET", value: "^/api/management/(v[1-9])/useradm/" } }]
|
|
488
|
-
},
|
|
489
|
-
{
|
|
490
|
-
...import_constants.defaultPermissionSets.ManageUsers,
|
|
491
|
-
action: import_constants.uiPermissionsById.manage.title,
|
|
492
|
-
object: permissionSetObjectTypes.userManagement,
|
|
493
|
-
description: "Set of permissions which allows user manage other user accounts",
|
|
494
|
-
permissions: [{ action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/useradm/" } }]
|
|
495
|
-
},
|
|
496
|
-
{
|
|
497
|
-
...import_constants.defaultPermissionSets.ReadTenants,
|
|
498
|
-
action: import_constants.uiPermissionsById.read.title,
|
|
499
|
-
object: permissionSetObjectTypes.tenantManagement,
|
|
500
|
-
description: "Set of permissions which allows user to list other tenants and their config",
|
|
501
|
-
permissions: [
|
|
502
|
-
{ action: "http", object: { type: "GET", value: "^/api/management/(v[1-9])/tenantadm/" } },
|
|
503
|
-
{ action: "http", object: { type: "POST", value: "^/api/management/(v[1-9])/tenantadm/" } }
|
|
504
|
-
]
|
|
505
|
-
},
|
|
506
|
-
{
|
|
507
|
-
...import_constants.defaultPermissionSets.ManageTenants,
|
|
508
|
-
action: import_constants.uiPermissionsById.manage.title,
|
|
509
|
-
object: permissionSetObjectTypes.tenantManagement,
|
|
510
|
-
description: "Set of permissions which allows user to manage other tenants and their config",
|
|
511
|
-
permissions: [
|
|
512
|
-
{ action: "http", object: { type: "GET", value: "^/api/management/(v[1-9])/tenantadm/" } },
|
|
513
|
-
{ action: "http", object: { type: "POST", value: "^/api/management/(v[1-9])/tenantadm/" } },
|
|
514
|
-
{ action: "http", object: { type: "PUT", value: "^/api/management/(v[1-9])/tenantadm/" } }
|
|
515
|
-
]
|
|
516
|
-
},
|
|
517
|
-
{
|
|
518
|
-
...import_constants.defaultPermissionSets.ReadAuditLogs,
|
|
519
|
-
action: import_constants.uiPermissionsById.read.title,
|
|
520
|
-
object: "System Audit Log",
|
|
521
|
-
description: "Set of permissions which allows user to view system audit log",
|
|
522
|
-
permissions: [{ action: "http", object: { type: "GET", value: "^/api/management/(v[1-9]|0.1.0)/auditlogs/logs" } }]
|
|
523
|
-
},
|
|
524
|
-
{
|
|
525
|
-
...import_constants.defaultPermissionSets.DeployToDevices,
|
|
526
|
-
action: "Deploy",
|
|
527
|
-
object: permissionSetObjectTypes.groups,
|
|
528
|
-
description: "Set of permissions which allows user to deploy to devices",
|
|
529
|
-
permissions: [{ action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/(deployments|deviceconfig)/" } }],
|
|
530
|
-
supported_scope_types: [import_constants.scopedPermissionAreas.groups.scopeType]
|
|
531
|
-
},
|
|
532
|
-
{
|
|
533
|
-
...import_constants.defaultPermissionSets.ConfigureDevices,
|
|
534
|
-
action: "Configure",
|
|
535
|
-
object: permissionSetObjectTypes.groups,
|
|
536
|
-
description: "Set of permissions which allows user to manage configuration of the devices",
|
|
537
|
-
permissions: [{ action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/deviceconfig/" } }],
|
|
538
|
-
supported_scope_types: [import_constants.scopedPermissionAreas.groups.scopeType]
|
|
539
|
-
},
|
|
540
|
-
{
|
|
541
|
-
...import_constants.defaultPermissionSets.ConnectToDevices,
|
|
542
|
-
action: "Connect",
|
|
543
|
-
object: permissionSetObjectTypes.groups,
|
|
544
|
-
description: "Set of permissions which allows user to use remote terminal and file transfer",
|
|
545
|
-
permissions: [
|
|
546
|
-
{ action: "http", object: { type: "GET", value: "^/api/management/(v[1-9]|0.1.0)/deviceconnect/devices/[^/]+/connect$" } },
|
|
547
|
-
{ action: "http", object: { type: "GET", value: "^/api/management/(v[1-9]|0.1.0)/deviceconnect/devices/[^/]+/download\\?path=[^&]+$" } },
|
|
548
|
-
{ action: "http", object: { type: "PUT", value: "^/api/management/(v[1-9]|0.1.0)/deviceconnect/devices/[^/]+/upload$" } }
|
|
549
|
-
],
|
|
550
|
-
supported_scope_types: [import_constants.scopedPermissionAreas.groups.scopeType]
|
|
551
|
-
},
|
|
552
|
-
{
|
|
553
|
-
...import_constants.defaultPermissionSets.SuperUser,
|
|
554
|
-
action: "Any",
|
|
555
|
-
object: permissionSetObjectTypes.any,
|
|
556
|
-
description: "Set of permissions which allows user to do anything",
|
|
557
|
-
permissions: [{ action: "any", object: { type: "any", value: "any" } }]
|
|
558
|
-
},
|
|
559
|
-
{
|
|
560
|
-
...import_constants.defaultPermissionSets.UploadArtifacts,
|
|
561
|
-
action: "Upload",
|
|
562
|
-
object: permissionSetObjectTypes.artifacts,
|
|
563
|
-
description: "Set of permissions which allows user to upload artifacts",
|
|
564
|
-
permissions: [
|
|
565
|
-
{ action: "http", object: { type: "POST", value: commonEndpoints.artifacts } },
|
|
566
|
-
{ action: "http", object: { type: "POST", value: "^/api/management/v1/deployments/artifacts/generate" } }
|
|
567
|
-
]
|
|
568
|
-
},
|
|
569
|
-
{
|
|
570
|
-
...import_constants.defaultPermissionSets.ReadDevices,
|
|
571
|
-
action: import_constants.uiPermissionsById.read.title,
|
|
572
|
-
object: permissionSetObjectTypes.groups,
|
|
573
|
-
description: "Set of permissions which allows user to view devices",
|
|
574
|
-
permissions: [
|
|
575
|
-
{ action: "http", object: { type: "POST", value: "^/api/management/v2/inventory/filters/search" } },
|
|
576
|
-
{ action: "http", object: { type: "POST", value: "^/api/management/v1/reporting/devices/search" } },
|
|
577
|
-
{ action: "http", object: { type: "GET", value: "^/api/management/(v[1-9])/(deployments|devauth|inventory|deviceconfig|devicemonitor)/" } },
|
|
578
|
-
{ action: "http", object: { type: "GET", value: "^/api/management/(v[1-9]|0.1.0)/deviceconnect/devices/[^/]+$" } }
|
|
579
|
-
],
|
|
580
|
-
supported_scope_types: [import_constants.scopedPermissionAreas.groups.scopeType]
|
|
581
|
-
},
|
|
582
|
-
{
|
|
583
|
-
...import_constants.defaultPermissionSets.ManageDevices,
|
|
584
|
-
action: import_constants.uiPermissionsById.manage.title,
|
|
585
|
-
object: permissionSetObjectTypes.groups,
|
|
586
|
-
description: "Set of permissions which allows user to manage devices",
|
|
587
|
-
permissions: [
|
|
588
|
-
{ action: "http", object: { type: "POST", value: commonEndpoints.deviceManagement } },
|
|
589
|
-
{ action: "http", object: { type: "PUT", value: commonEndpoints.deviceManagement } },
|
|
590
|
-
{ action: "http", object: { type: "DELETE", value: commonEndpoints.deviceManagement } }
|
|
591
|
-
],
|
|
592
|
-
supported_scope_types: [import_constants.scopedPermissionAreas.groups.scopeType]
|
|
593
|
-
},
|
|
594
|
-
{
|
|
595
|
-
...import_constants.defaultPermissionSets.ReadReleases,
|
|
596
|
-
action: import_constants.uiPermissionsById.read.title,
|
|
597
|
-
object: permissionSetObjectTypes.releases,
|
|
598
|
-
description: "Set of permissions which allows user to view releases",
|
|
599
|
-
permissions: [
|
|
600
|
-
{ action: "http", object: { type: "GET", value: commonEndpoints.artifacts } },
|
|
601
|
-
{ action: "http", object: { type: "GET", value: commonEndpoints.artifactDetails } },
|
|
602
|
-
{ action: "http", object: { type: "GET", value: "^/api/management/v1/deployments/artifacts/[^/]+/download" } }
|
|
603
|
-
]
|
|
604
|
-
},
|
|
605
|
-
{
|
|
606
|
-
name: "almostAdmin",
|
|
607
|
-
object: permissionSetObjectTypes.empty,
|
|
608
|
-
description: "Set containing all the permissions.",
|
|
609
|
-
permissions: [
|
|
610
|
-
{ action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/auditlogs/.*" } },
|
|
611
|
-
{ action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/deployments/.*" } },
|
|
612
|
-
{ action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/deployments/config/.*" } },
|
|
613
|
-
{ action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/deployments/deployments/.*" } },
|
|
614
|
-
{ action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/deployments/deployments/releases/.*" } },
|
|
615
|
-
{ action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/devauth/.*" } },
|
|
616
|
-
{ action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/deviceconfig/.*" } },
|
|
617
|
-
{ action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/deviceconnect/.*" } },
|
|
618
|
-
{ action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/deviceconnect/devices" } },
|
|
619
|
-
{ action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/inventory/.*" } },
|
|
620
|
-
{ action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/iot-manager/.*" } },
|
|
621
|
-
{ action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/monitor/.*" } },
|
|
622
|
-
{ action: "http", object: { type: "any", value: "^/api/management/(v[1-9])/useradm/.*" } }
|
|
623
|
-
]
|
|
624
|
-
}
|
|
625
|
-
];
|
|
626
|
-
var rbacRoles = [
|
|
627
|
-
{
|
|
628
|
-
name: "dyn",
|
|
629
|
-
description: "",
|
|
630
|
-
permissions: [
|
|
631
|
-
{ action: "CREATE_DEPLOYMENT", object: { type: "DEVICE_GROUP", value: "dyn" } },
|
|
632
|
-
{ action: "VIEW_DEVICE", object: { type: "DEVICE_GROUP", value: "dyn" } }
|
|
633
|
-
]
|
|
634
|
-
},
|
|
635
|
-
{ name: "asdasd", description: "123", permissions: [{ action: "http", object: { type: "any", value: "/api/management/v1/useradm/.*" } }] },
|
|
636
|
-
{
|
|
637
|
-
name: "141sasd",
|
|
638
|
-
description: "1313adg",
|
|
639
|
-
permission_sets_with_scope: [
|
|
640
|
-
{ ...import_constants.defaultPermissionSets.ReadDevices, scope: { type: import_constants.scopedPermissionAreas.groups.scopeType, value: ["bestgroup"] } },
|
|
641
|
-
{ ...import_constants.defaultPermissionSets.ConnectToDevices, scope: { type: import_constants.scopedPermissionAreas.groups.scopeType, value: ["bestgroup"] } },
|
|
642
|
-
{ ...import_constants.defaultPermissionSets.ManageUsers }
|
|
643
|
-
]
|
|
644
|
-
},
|
|
645
|
-
{
|
|
646
|
-
name: "kljlkk",
|
|
647
|
-
description: "lkl",
|
|
648
|
-
permission_sets_with_scope: [{ ...import_constants.defaultPermissionSets.ConnectToDevices, scope: { type: import_constants.scopedPermissionAreas.groups.scopeType, value: ["bestgroup"] } }]
|
|
649
|
-
},
|
|
650
|
-
{
|
|
651
|
-
name: "yyyyy",
|
|
652
|
-
description: "asd",
|
|
653
|
-
permission_sets_with_scope: [
|
|
654
|
-
{ ...import_constants.defaultPermissionSets.ManageDevices, scope: { type: import_constants.scopedPermissionAreas.groups.scopeType, value: ["dockerclient"] } },
|
|
655
|
-
{ ...import_constants.defaultPermissionSets.ManageReleases }
|
|
656
|
-
]
|
|
657
|
-
},
|
|
658
|
-
{
|
|
659
|
-
name: "RBAC_ROLE_DEPLOYMENTS_MANAGER",
|
|
660
|
-
description: "Intended for users responsible for managing deployments, this role can create and abort deployments",
|
|
661
|
-
permission_sets_with_scope: [{ ...import_constants.defaultPermissionSets.DeployToDevices }]
|
|
662
|
-
},
|
|
663
|
-
{
|
|
664
|
-
name: "RBAC_ROLE_REMOTE_TERMINAL",
|
|
665
|
-
description: `Intended for tech support accounts, this role can access the devices' Remote Terminal.`,
|
|
666
|
-
permission_sets_with_scope: [{ ...import_constants.defaultPermissionSets.ConnectToDevices }]
|
|
667
|
-
},
|
|
668
|
-
{ name: "RBAC_ROLE_PERMIT_ALL", description: "", permission_sets_with_scope: [{ ...import_constants.defaultPermissionSets.SuperUser }] },
|
|
669
|
-
{
|
|
670
|
-
name: "RBAC_ROLE_OBSERVER",
|
|
671
|
-
description: "Intended for team leaders or limited tech support accounts, this role can see all Devices, Artifacts and Deployment reports but not make any changes.",
|
|
672
|
-
permission_sets_with_scope: [{ ...import_constants.defaultPermissionSets.ReadReleases }, { ...import_constants.defaultPermissionSets.ReadDevices }]
|
|
673
|
-
},
|
|
674
|
-
{
|
|
675
|
-
name: "RBAC_ROLE_CI",
|
|
676
|
-
description: "Intended for automation accounts building software (e.g. CI/CD systems), this role can only manage Artifacts, including upload new Artifacts and delete Artifacts. It does not have access to Devices or Deployments.",
|
|
677
|
-
permission_sets_with_scope: [
|
|
678
|
-
{ ...import_constants.defaultPermissionSets.ReadReleases },
|
|
679
|
-
{ ...import_constants.defaultPermissionSets.ManageReleases },
|
|
680
|
-
{ ...import_constants.defaultPermissionSets.UploadArtifacts }
|
|
681
|
-
]
|
|
682
|
-
},
|
|
683
|
-
{
|
|
684
|
-
name: "almostAdmin",
|
|
685
|
-
description: "almost admin rights",
|
|
686
|
-
permissions: permissionSets.find((item) => item.name === "almostAdmin")?.permissions
|
|
687
|
-
},
|
|
688
|
-
{
|
|
689
|
-
name: "almostAdminNew",
|
|
690
|
-
description: "almost admin rights",
|
|
691
|
-
permission_sets_with_scope: Object.values(import_constants.defaultPermissionSets)
|
|
692
|
-
}
|
|
693
|
-
];
|
|
694
|
-
var expectedParsedRoles = {
|
|
695
|
-
"141sasd": {
|
|
696
|
-
editable: true,
|
|
697
|
-
isCustom: void 0,
|
|
698
|
-
uiPermissions: {
|
|
699
|
-
...import_constants.emptyUiPermissions,
|
|
700
|
-
groups: { bestgroup: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.connect.value] },
|
|
701
|
-
userManagement: [import_constants.uiPermissionsById.manage.value]
|
|
702
|
-
}
|
|
703
|
-
},
|
|
704
|
-
asdasd: {
|
|
705
|
-
editable: false,
|
|
706
|
-
isCustom: true,
|
|
707
|
-
uiPermissions: { ...import_constants.emptyUiPermissions, userManagement: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.manage.value] }
|
|
708
|
-
},
|
|
709
|
-
dyn: {
|
|
710
|
-
editable: false,
|
|
711
|
-
isCustom: true,
|
|
712
|
-
uiPermissions: {
|
|
713
|
-
...import_constants.emptyUiPermissions,
|
|
714
|
-
deployments: [import_constants.uiPermissionsById.deploy.value],
|
|
715
|
-
groups: { dyn: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.deploy.value] }
|
|
716
|
-
}
|
|
717
|
-
},
|
|
718
|
-
kljlkk: {
|
|
719
|
-
editable: true,
|
|
720
|
-
isCustom: false,
|
|
721
|
-
uiPermissions: { ...import_constants.emptyUiPermissions, groups: { bestgroup: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.connect.value] } }
|
|
722
|
-
},
|
|
723
|
-
yyyyy: {
|
|
724
|
-
editable: true,
|
|
725
|
-
isCustom: void 0,
|
|
726
|
-
uiPermissions: {
|
|
727
|
-
...import_constants.emptyUiPermissions,
|
|
728
|
-
groups: { dockerclient: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.manage.value] },
|
|
729
|
-
releases: { [import_constants.ALL_RELEASES]: [import_constants.uiPermissionsById.manage.value] }
|
|
730
|
-
}
|
|
731
|
-
},
|
|
732
|
-
almostAdmin: {
|
|
733
|
-
editable: false,
|
|
734
|
-
isCustom: true,
|
|
735
|
-
uiPermissions: {
|
|
736
|
-
...import_constants.emptyUiPermissions,
|
|
737
|
-
auditlog: [import_constants.uiPermissionsById.read.value],
|
|
738
|
-
deployments: [import_constants.uiPermissionsById.manage.value, import_constants.uiPermissionsById.deploy.value, import_constants.uiPermissionsById.read.value],
|
|
739
|
-
groups: {
|
|
740
|
-
[import_constants.ALL_DEVICES]: [
|
|
741
|
-
import_constants.uiPermissionsById.read.value,
|
|
742
|
-
// we can't assign deployment permissions to devices here, since the old path based rbac controls don't allow the scoped permissions
|
|
743
|
-
// uiPermissionsById.deploy.value,
|
|
744
|
-
import_constants.uiPermissionsById.manage.value,
|
|
745
|
-
import_constants.uiPermissionsById.connect.value,
|
|
746
|
-
import_constants.uiPermissionsById.configure.value
|
|
747
|
-
]
|
|
748
|
-
},
|
|
749
|
-
releases: {
|
|
750
|
-
[import_constants.ALL_RELEASES]: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.upload.value, import_constants.uiPermissionsById.manage.value]
|
|
751
|
-
},
|
|
752
|
-
userManagement: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.manage.value]
|
|
753
|
-
}
|
|
754
|
-
},
|
|
755
|
-
almostAdminNew: {
|
|
756
|
-
editable: true,
|
|
757
|
-
isCustom: void 0,
|
|
758
|
-
uiPermissions: {
|
|
759
|
-
...import_constants.emptyUiPermissions,
|
|
760
|
-
auditlog: [import_constants.uiPermissionsById.read.value],
|
|
761
|
-
deployments: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.deploy.value, import_constants.uiPermissionsById.manage.value],
|
|
762
|
-
groups: {
|
|
763
|
-
[import_constants.ALL_DEVICES]: [
|
|
764
|
-
import_constants.uiPermissionsById.read.value,
|
|
765
|
-
import_constants.uiPermissionsById.manage.value,
|
|
766
|
-
import_constants.uiPermissionsById.deploy.value,
|
|
767
|
-
import_constants.uiPermissionsById.connect.value,
|
|
768
|
-
import_constants.uiPermissionsById.configure.value
|
|
769
|
-
]
|
|
770
|
-
},
|
|
771
|
-
releases: {
|
|
772
|
-
[import_constants.ALL_RELEASES]: [import_constants.uiPermissionsById.manage.value, import_constants.uiPermissionsById.upload.value, import_constants.uiPermissionsById.read.value]
|
|
773
|
-
},
|
|
774
|
-
tenantManagement: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.manage.value],
|
|
775
|
-
userManagement: [import_constants.uiPermissionsById.read.value, import_constants.uiPermissionsById.manage.value]
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
};
|
|
779
|
-
var defaultRolesById = {
|
|
780
|
-
...import_constants.rolesById,
|
|
781
|
-
test: {
|
|
782
|
-
...import_constants.emptyRole,
|
|
783
|
-
name: "test",
|
|
784
|
-
description: "test description",
|
|
785
|
-
editable: true,
|
|
786
|
-
uiPermissions: {
|
|
787
|
-
...import_constants.emptyUiPermissions,
|
|
788
|
-
groups: { testGroup: [import_constants.uiPermissionsById.read.value] },
|
|
789
|
-
releases: { bar: [import_constants.uiPermissionsById.read.value] }
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
};
|
|
793
|
-
var receivedRoles = rbacRoles.reduce(
|
|
794
|
-
(accu, role) => {
|
|
795
|
-
const { name, description, ...roleRemainder } = role;
|
|
796
|
-
if (name.startsWith("RBAC")) {
|
|
797
|
-
accu[name] = {
|
|
798
|
-
...defaultRolesById[name],
|
|
799
|
-
...roleRemainder,
|
|
800
|
-
editable: false,
|
|
801
|
-
isCustom: false,
|
|
802
|
-
description: defaultRolesById[name].description ? defaultRolesById[name].description : description
|
|
803
|
-
};
|
|
804
|
-
} else {
|
|
805
|
-
const result = expectedParsedRoles[name] ?? {};
|
|
806
|
-
accu[name] = {
|
|
807
|
-
...import_constants.emptyRole,
|
|
808
|
-
...role,
|
|
809
|
-
...result,
|
|
810
|
-
name
|
|
811
|
-
};
|
|
812
|
-
}
|
|
813
|
-
return accu;
|
|
814
|
-
},
|
|
815
|
-
{ ...defaultRolesById }
|
|
816
|
-
);
|
|
817
|
-
var receivedPermissionSets = permissionSets.reduce((accu, set) => {
|
|
818
|
-
const result = import_constants.defaultPermissionSets[set.name]?.result ?? {};
|
|
819
|
-
accu[set.name] = {
|
|
820
|
-
...set,
|
|
821
|
-
result: {
|
|
822
|
-
...import_constants.emptyUiPermissions,
|
|
823
|
-
...result
|
|
824
|
-
}
|
|
825
|
-
};
|
|
826
|
-
return accu;
|
|
827
|
-
}, {});
|
|
828
|
-
|
|
829
|
-
// src/requestHandlers/organizationHandlers.ts
|
|
830
|
-
var PLANS = {
|
|
831
|
-
os: { id: "os", name: "Basic" },
|
|
832
|
-
professional: { id: "professional", name: "Professional" },
|
|
833
|
-
enterprise: { id: "enterprise", name: "Enterprise" }
|
|
834
|
-
};
|
|
835
|
-
var releasesSample = {
|
|
836
|
-
lts: ["3.3"],
|
|
837
|
-
releases: {
|
|
838
|
-
"3.2": {
|
|
839
|
-
"3.2.1": {
|
|
840
|
-
release_date: "2022-02-02",
|
|
841
|
-
release: "3.2.1",
|
|
842
|
-
repos: [
|
|
843
|
-
{ name: "integration", version: "1.2.3" },
|
|
844
|
-
{ name: "mender", version: "3.2.1" },
|
|
845
|
-
{ name: "mender-artifact", version: "1.3.7" },
|
|
846
|
-
{ name: "service", version: "3.0.0" },
|
|
847
|
-
{ name: "other-service", version: "1.1.0" }
|
|
848
|
-
]
|
|
849
|
-
},
|
|
850
|
-
"3.2.0": {
|
|
851
|
-
release_date: "2022-01-24",
|
|
852
|
-
release: "3.2.0",
|
|
853
|
-
repos: [
|
|
854
|
-
{ name: "service", version: "3.0.0" },
|
|
855
|
-
{ name: "another-service", version: "4.1.0" }
|
|
856
|
-
]
|
|
857
|
-
}
|
|
858
|
-
},
|
|
859
|
-
"2.7": {
|
|
860
|
-
"2.7.2": {
|
|
861
|
-
release_date: "2021-11-04",
|
|
862
|
-
release: "2.7.2",
|
|
863
|
-
repos: [
|
|
864
|
-
{ name: "service", version: "1.1.0" },
|
|
865
|
-
{ name: "more-service", version: "1.0.2" }
|
|
866
|
-
]
|
|
867
|
-
}
|
|
868
|
-
},
|
|
869
|
-
"1.0": {
|
|
870
|
-
supported_until: "2018-02",
|
|
871
|
-
"1.0.1": {
|
|
872
|
-
release_date: "2017-04-03",
|
|
873
|
-
release: "1.0.1",
|
|
874
|
-
repos: [{ name: "service", version: "1.0.1" }]
|
|
875
|
-
},
|
|
876
|
-
"1.0.0": {
|
|
877
|
-
release_date: "2017-02-16",
|
|
878
|
-
release: "1.0.0",
|
|
879
|
-
repos: [{ name: "mono-service", version: "1.0.0" }]
|
|
880
|
-
}
|
|
881
|
-
}
|
|
882
|
-
},
|
|
883
|
-
saas: [
|
|
884
|
-
{ tag: "saas-v2022.03.10", date: "2022-03-09" },
|
|
885
|
-
{ tag: "saas-v2020.09.25", date: "2020-09-24" },
|
|
886
|
-
{ tag: "saas-v2020.07.09", date: "2020-07-09" }
|
|
887
|
-
]
|
|
888
|
-
};
|
|
889
|
-
var tagsSample = [{ name: "saas-v2023.05.02", more: "here" }];
|
|
890
|
-
var signupHandler = async ({ request }) => {
|
|
891
|
-
const signup = await request.json();
|
|
892
|
-
if (["email", "organization", "plan", "tos"].every((item) => !!signup[item])) {
|
|
893
|
-
return import_msw.HttpResponse.text("test");
|
|
894
|
-
}
|
|
895
|
-
return new import_msw.HttpResponse(null, { status: 400 });
|
|
896
|
-
};
|
|
897
|
-
var invoicePreviewBasic = {
|
|
898
|
-
id: "upcoming_in_1RlAkbFlFfXikjZVOHK5VQx0",
|
|
899
|
-
period_start: "2025-07-15T15:25:22Z",
|
|
900
|
-
period_end: "2025-08-15T15:25:22Z",
|
|
901
|
-
total: 3200,
|
|
902
|
-
currency: "usd",
|
|
903
|
-
lines: [
|
|
904
|
-
{
|
|
905
|
-
description: "50 device \xD7 Mender Basic (Tier 1 at $0.00 / month)",
|
|
906
|
-
amount: 0,
|
|
907
|
-
currency: "usd",
|
|
908
|
-
product: "mender_standard",
|
|
909
|
-
quantity: 50,
|
|
910
|
-
price_id: "price_1PYktlFlFfXikjZVh2aNHp7i"
|
|
911
|
-
},
|
|
912
|
-
{
|
|
913
|
-
description: "Mender Basic (Tier 1 at $32.00 / month)",
|
|
914
|
-
amount: 3200,
|
|
915
|
-
currency: "usd",
|
|
916
|
-
product: "mender_standard",
|
|
917
|
-
quantity: 0,
|
|
918
|
-
price_id: "price_1PYktlFlFfXikjZVh2aNHp7i"
|
|
919
|
-
}
|
|
920
|
-
]
|
|
921
|
-
};
|
|
922
|
-
var subscriptionBasic = {
|
|
923
|
-
id: "sub_1RlAjOFlFfXikjZVj5BvpJE4",
|
|
924
|
-
status: "active",
|
|
925
|
-
plan: "os",
|
|
926
|
-
products: [
|
|
927
|
-
{
|
|
928
|
-
name: "mender_standard",
|
|
929
|
-
quantity: 50
|
|
930
|
-
}
|
|
931
|
-
]
|
|
932
|
-
};
|
|
933
|
-
var organizationHandlers = [
|
|
934
|
-
import_msw.http.get("/tags.json", () => import_msw.HttpResponse.json(tagsSample)),
|
|
935
|
-
import_msw.http.get("/versions.json", () => import_msw.HttpResponse.json(releasesSample)),
|
|
936
|
-
import_msw.http.get(`${import_constants2.tenantadmApiUrlv1}/user/tenant`, () => import_msw.HttpResponse.json(mockApiResponses.organization.organization)),
|
|
937
|
-
import_msw.http.put(`${import_constants2.tenantadmApiUrlv2}/tenants/:tenantId/child`, () => new import_msw.HttpResponse(null, { status: 200 })),
|
|
938
|
-
import_msw.http.post(`${import_constants2.tenantadmApiUrlv2}/tenants/:tenantId/cancel`, () => new import_msw.HttpResponse(null, { status: 200 })),
|
|
939
|
-
import_msw.http.post(`${import_constants2.tenantadmApiUrlv2}/tenants/trial`, signupHandler),
|
|
940
|
-
import_msw.http.post(`${import_constants2.tenantadmApiUrlv2}/tenants`, async ({ request }) => {
|
|
941
|
-
const { users } = await request.json();
|
|
942
|
-
const { email } = users[0];
|
|
943
|
-
if (email.includes("bad")) {
|
|
944
|
-
return new import_msw.HttpResponse(null, { status: 553 });
|
|
945
|
-
}
|
|
946
|
-
return new import_msw.HttpResponse(null, { status: 200 });
|
|
947
|
-
}),
|
|
948
|
-
import_msw.http.post(`https://hosted.mender.io${import_constants2.tenantadmApiUrlv2}/tenants/trial`, signupHandler),
|
|
949
|
-
import_msw.http.get(`${import_constants2.tenantadmApiUrlv2}/tenants`, () => new import_msw.HttpResponse([])),
|
|
950
|
-
import_msw.http.get(`${import_constants2.tenantadmApiUrlv2}/billing`, () => import_msw.HttpResponse.json({ card: { last4: "7890", exp_month: 1, exp_year: 2024, brand: "testCorp" } })),
|
|
951
|
-
import_msw.http.get(
|
|
952
|
-
`${import_constants2.tenantadmApiUrlv2}/billing/profile`,
|
|
953
|
-
() => import_msw.HttpResponse.json({
|
|
954
|
-
name: "company",
|
|
955
|
-
email: "test@test.com",
|
|
956
|
-
address: { state: "OSLO", line1: "Blindern", country: "NO", city: "OSLO", postal_code: "0123" },
|
|
957
|
-
shipping: { address: { state: "OSLO", line1: "Blindern", country: "NO", city: "OSLO", postal_code: "0123" } }
|
|
958
|
-
})
|
|
959
|
-
),
|
|
960
|
-
import_msw.http.post(`${import_constants2.tenantadmApiUrlv2}/billing/card`, () => import_msw.HttpResponse.json({ intent_id: mockApiResponses.organization.intentId, secret: "testSecret" })),
|
|
961
|
-
import_msw.http.post(
|
|
962
|
-
`${import_constants2.tenantadmApiUrlv2}/billing/card/:intentId/confirm`,
|
|
963
|
-
({ params: { intentId } }) => new import_msw.HttpResponse(null, { status: intentId == mockApiResponses.organization.intentId ? 200 : 540 })
|
|
964
|
-
),
|
|
965
|
-
import_msw.http.post(`${import_constants2.tenantadmApiUrlv2}/tenants/:tenantId/upgrade/:status`, async ({ params: { status, tenantId }, request }) => {
|
|
966
|
-
if (tenantId != mockApiResponses.organization.organization.id || !["cancel", "complete", "start"].includes(status)) {
|
|
967
|
-
return new import_msw.HttpResponse(null, { status: 541 });
|
|
968
|
-
}
|
|
969
|
-
if (status === "start") {
|
|
970
|
-
return import_msw.HttpResponse.json({ secret: "testSecret" });
|
|
971
|
-
}
|
|
972
|
-
let plan;
|
|
973
|
-
try {
|
|
974
|
-
const body = await request.json();
|
|
975
|
-
plan = body.plan;
|
|
976
|
-
} catch {
|
|
977
|
-
}
|
|
978
|
-
if (plan && !Object.keys(PLANS).includes(plan)) {
|
|
979
|
-
return new import_msw.HttpResponse(null, { status: 542 });
|
|
980
|
-
}
|
|
981
|
-
return new import_msw.HttpResponse(null, { status: 200 });
|
|
982
|
-
}),
|
|
983
|
-
import_msw.http.post(`${import_constants2.tenantadmApiUrlv2}/tenants/:tenantId/plan`, async ({ params: { tenantId }, request }) => {
|
|
984
|
-
const body = await request.json();
|
|
985
|
-
const expectedKeys = ["current_plan", "requested_plan", "current_addons", "requested_addons", "user_message"];
|
|
986
|
-
if (tenantId != mockApiResponses.organization.organization.id || !Object.keys(body).every((key) => expectedKeys.includes(key))) {
|
|
987
|
-
return new import_msw.HttpResponse(null, { status: 544 });
|
|
988
|
-
}
|
|
989
|
-
if (body.requested_plan && !Object.values(PLANS).some((item) => item.name === body.requested_plan)) {
|
|
990
|
-
return new import_msw.HttpResponse(null, { status: 545 });
|
|
991
|
-
}
|
|
992
|
-
return new import_msw.HttpResponse(null, { status: 200 });
|
|
993
|
-
}),
|
|
994
|
-
import_msw.http.post(`${import_constants2.tenantadmApiUrlv2}/contact/support`, async ({ request }) => {
|
|
995
|
-
const { subject, body } = await request.json();
|
|
996
|
-
if (!(subject && body)) {
|
|
997
|
-
return new import_msw.HttpResponse(null, { status: 543 });
|
|
998
|
-
}
|
|
999
|
-
return new import_msw.HttpResponse(null, { status: 200 });
|
|
1000
|
-
}),
|
|
1001
|
-
import_msw.http.patch(`${import_constants2.tenantadmApiUrlv2}/billing/profile`, () => new import_msw.HttpResponse(null, { status: 200 })),
|
|
1002
|
-
import_msw.http.post(`${import_constants2.tenantadmApiUrlv2}/billing/profile`, () => new import_msw.HttpResponse(null, { status: 200 })),
|
|
1003
|
-
import_msw.http.post(`${import_constants2.tenantadmApiUrlv2}/billing/subscription`, () => new import_msw.HttpResponse(null, { status: 202 })),
|
|
1004
|
-
import_msw.http.post(`${import_constants2.tenantadmApiUrlv2}/billing/subscription/invoices/preview`, () => import_msw.HttpResponse.json(invoicePreviewBasic)),
|
|
1005
|
-
import_msw.http.get(`${import_constants2.tenantadmApiUrlv2}/billing/subscription`, () => import_msw.HttpResponse.json(subscriptionBasic)),
|
|
1006
|
-
import_msw.http.get(`${import_constants2.tenantadmApiUrlv2}/billing/products`, () => import_msw.HttpResponse.json(mockApiResponses.organization.products)),
|
|
1007
|
-
import_msw.http.get(`${import_constants2.auditLogsApiUrl}/logs`, ({ request }) => {
|
|
1008
|
-
const { searchParams } = new URL(request.url);
|
|
1009
|
-
const perPage = Number(searchParams.get("per_page"));
|
|
1010
|
-
if (perPage === 500) {
|
|
1011
|
-
return import_msw.HttpResponse.json([
|
|
1012
|
-
{ meta: mockApiResponses.organization.auditlog.events[2].meta, time: mockApiResponses.organization.auditlog.events[1].time, action: "close_terminal" }
|
|
1013
|
-
]);
|
|
1014
|
-
}
|
|
1015
|
-
return new import_msw.HttpResponse(JSON.stringify(mockApiResponses.organization.auditlog.events), {
|
|
1016
|
-
headers: { [import_constants2.headerNames.total]: mockApiResponses.organization.auditlog.events.length }
|
|
1017
|
-
});
|
|
1018
|
-
}),
|
|
1019
|
-
import_msw.http.get(
|
|
1020
|
-
`${import_constants2.auditLogsApiUrl}/logs/export`,
|
|
1021
|
-
() => import_msw.HttpResponse.text(`action,actor.id,actor.type,actor.email,actor.identity_data,object.id,object.type,object.user.email,object.deployment.name,object.deployment.artifact_name,change
|
|
1022
|
-
update,5c56c2ed-2a9a-5de9-bb86-cf38b3d4a5e1,user,test@example.coim,,067f23a9-76a5-5585-b119-32402a120978,user,test@example.com,,,"Update user 067f23a9-76a5-5585-b119-32402a120978 (test@example.com).
|
|
1023
|
-
Diff:
|
|
1024
|
-
--- Original
|
|
1025
|
-
+++ Current
|
|
1026
|
-
@@ -9 +9,2 @@
|
|
1027
|
-
- ""RBAC_ROLE_OBSERVER""
|
|
1028
|
-
+ ""RBAC_ROLE_OBSERVER"",
|
|
1029
|
-
+ ""RBAC_ROLE_PERMIT_ALL""
|
|
1030
|
-
"
|
|
1031
|
-
`)
|
|
1032
|
-
),
|
|
1033
|
-
import_msw.http.get(
|
|
1034
|
-
`${import_constants2.iotManagerBaseURL}/integrations`,
|
|
1035
|
-
() => import_msw.HttpResponse.json([
|
|
1036
|
-
{ connection_string: "something_else", id: 1, provider: "iot-hub" },
|
|
1037
|
-
{ id: 2, provider: "iot-core", something: "new" }
|
|
1038
|
-
])
|
|
1039
|
-
),
|
|
1040
|
-
import_msw.http.post(`${import_constants2.iotManagerBaseURL}/integrations`, () => import_msw.HttpResponse.json([{ connection_string: "something_else", provider: "iot-hub" }])),
|
|
1041
|
-
import_msw.http.put(`${import_constants2.iotManagerBaseURL}/integrations/:integrationId`, ({ params: { integrationId } }) => {
|
|
1042
|
-
if (!integrationId) {
|
|
1043
|
-
return new import_msw.HttpResponse(null, { status: 547 });
|
|
1044
|
-
}
|
|
1045
|
-
return new import_msw.HttpResponse(null, { status: 200 });
|
|
1046
|
-
}),
|
|
1047
|
-
import_msw.http.put(`${import_constants2.iotManagerBaseURL}/integrations/:integrationId/credentials`, ({ params: { integrationId } }) => {
|
|
1048
|
-
if (!integrationId) {
|
|
1049
|
-
return new import_msw.HttpResponse(null, { status: 548 });
|
|
1050
|
-
}
|
|
1051
|
-
return new import_msw.HttpResponse(null, { status: 200 });
|
|
1052
|
-
}),
|
|
1053
|
-
import_msw.http.delete(`${import_constants2.iotManagerBaseURL}/integrations/:integrationId`, ({ params: { integrationId } }) => {
|
|
1054
|
-
if (!integrationId) {
|
|
1055
|
-
return new import_msw.HttpResponse(null, { status: 549 });
|
|
1056
|
-
}
|
|
1057
|
-
return new import_msw.HttpResponse(null, { status: 200 });
|
|
1058
|
-
}),
|
|
1059
|
-
import_msw.http.get(`${import_constants2.iotManagerBaseURL}/events`, ({ request }) => {
|
|
1060
|
-
const { searchParams } = new URL(request.url);
|
|
1061
|
-
const page = Number(searchParams.get("page"));
|
|
1062
|
-
const perPage = Number(searchParams.get("per_page"));
|
|
1063
|
-
return import_msw.HttpResponse.json(webhookEvents.slice(page - 1, page * perPage));
|
|
1064
|
-
}),
|
|
1065
|
-
import_msw.http.get(
|
|
1066
|
-
import_constants2.ssoIdpApiUrlv1,
|
|
1067
|
-
() => import_msw.HttpResponse.json([
|
|
1068
|
-
{ id: "1", issuer: "https://samltest.id/saml/idp", valid_until: "2038-08-24T21:14:09Z" },
|
|
1069
|
-
{ id: "2", issuer: "https://samltest2.id/saml/idp", valid_until: "2030-10-24T21:14:09Z" }
|
|
1070
|
-
])
|
|
1071
|
-
),
|
|
1072
|
-
import_msw.http.post(import_constants2.ssoIdpApiUrlv1, () => new import_msw.HttpResponse(null, { status: 200 })),
|
|
1073
|
-
import_msw.http.get(`${import_constants2.ssoIdpApiUrlv1}/:configId`, ({ params: { configId } }) => {
|
|
1074
|
-
if (!configId) {
|
|
1075
|
-
return new import_msw.HttpResponse(null, { status: 550 });
|
|
1076
|
-
}
|
|
1077
|
-
return import_msw.HttpResponse.json({ email: "user@acme.com", password: "mypass1234", login: { google: "bob@gmail.com" }, config: "<div>not quite right</div>" });
|
|
1078
|
-
}),
|
|
1079
|
-
import_msw.http.put(`${import_constants2.ssoIdpApiUrlv1}/:configId`, ({ params: { configId } }) => new import_msw.HttpResponse(null, { status: configId ? 200 : 551 })),
|
|
1080
|
-
import_msw.http.delete(`${import_constants2.ssoIdpApiUrlv1}/:configId`, ({ params: { configId } }) => new import_msw.HttpResponse(null, { status: configId ? 200 : 552 }))
|
|
1081
|
-
];
|
|
1082
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
1083
|
-
0 && (module.exports = {
|
|
1084
|
-
organizationHandlers
|
|
1085
|
-
});
|
|
1086
|
-
//# sourceMappingURL=organizationHandlers.cjs.map
|