@northern.tech/testing 0.8.1 → 0.8.4
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/mockData.cjs +1302 -0
- package/dist/mockData.cjs.map +1 -0
- package/dist/mockData.d.cts +662 -0
- package/dist/mockData.d.ts +662 -0
- package/dist/mockData.js +1280 -0
- package/dist/mockData.js.map +1 -0
- package/dist/public/baseTestConfig.json +17 -0
- package/dist/requestHandlers/deploymentHandlers.cjs +193 -0
- package/dist/requestHandlers/deploymentHandlers.cjs.map +1 -0
- package/dist/requestHandlers/deploymentHandlers.d.cts +7 -0
- package/dist/requestHandlers/deploymentHandlers.d.ts +7 -0
- package/dist/requestHandlers/deploymentHandlers.js +191 -0
- package/dist/requestHandlers/deploymentHandlers.js.map +1 -0
- package/dist/requestHandlers/deviceHandlers.cjs +432 -0
- package/dist/requestHandlers/deviceHandlers.cjs.map +1 -0
- package/dist/requestHandlers/deviceHandlers.d.cts +22 -0
- package/dist/requestHandlers/deviceHandlers.d.ts +22 -0
- package/dist/requestHandlers/deviceHandlers.js +428 -0
- package/dist/requestHandlers/deviceHandlers.js.map +1 -0
- package/dist/requestHandlers/monitorHandlers.cjs +23 -0
- package/dist/requestHandlers/monitorHandlers.cjs.map +1 -0
- package/dist/requestHandlers/monitorHandlers.d.cts +7 -0
- package/dist/requestHandlers/monitorHandlers.d.ts +7 -0
- package/dist/requestHandlers/monitorHandlers.js +21 -0
- package/dist/requestHandlers/monitorHandlers.js.map +1 -0
- package/dist/requestHandlers/organizationHandlers.cjs +312 -0
- package/dist/requestHandlers/organizationHandlers.cjs.map +1 -0
- package/dist/requestHandlers/organizationHandlers.d.cts +7 -0
- package/dist/requestHandlers/organizationHandlers.d.ts +7 -0
- package/dist/requestHandlers/organizationHandlers.js +310 -0
- package/dist/requestHandlers/organizationHandlers.js.map +1 -0
- package/dist/requestHandlers/releaseHandlers.cjs +161 -0
- package/dist/requestHandlers/releaseHandlers.cjs.map +1 -0
- package/dist/requestHandlers/releaseHandlers.d.cts +7 -0
- package/dist/requestHandlers/releaseHandlers.d.ts +7 -0
- package/dist/requestHandlers/releaseHandlers.js +159 -0
- package/dist/requestHandlers/releaseHandlers.js.map +1 -0
- package/dist/requestHandlers/requestHandlers.cjs +28 -0
- package/dist/requestHandlers/requestHandlers.cjs.map +1 -0
- package/dist/requestHandlers/requestHandlers.d.cts +6 -0
- package/dist/requestHandlers/requestHandlers.d.ts +7 -0
- package/dist/requestHandlers/requestHandlers.js +27 -0
- package/dist/requestHandlers/requestHandlers.js.map +1 -0
- package/dist/requestHandlers/userHandlers.cjs +141 -0
- package/dist/requestHandlers/userHandlers.cjs.map +1 -0
- package/dist/requestHandlers/userHandlers.d.cts +7 -0
- package/dist/requestHandlers/userHandlers.d.ts +7 -0
- package/dist/requestHandlers/userHandlers.js +139 -0
- package/dist/requestHandlers/userHandlers.js.map +1 -0
- package/dist/setupTests.cjs +173 -0
- package/dist/setupTests.cjs.map +1 -0
- package/dist/setupTests.d.cts +79 -0
- package/dist/setupTests.d.ts +79 -0
- package/dist/setupTests.js +135 -0
- package/dist/setupTests.js.map +1 -0
- package/dist/theme/light.cjs +9 -0
- package/dist/theme/light.cjs.map +1 -0
- package/dist/theme/light.d.cts +7 -0
- package/dist/theme/light.d.ts +7 -0
- package/dist/theme/light.js +8 -0
- package/dist/theme/light.js.map +1 -0
- package/dist/theme/mui.d.cjs +0 -0
- package/dist/theme/mui.d.cts +11 -0
- package/dist/theme/mui.d.ts +11 -0
- package/dist/utils.cjs +21 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.cts +8 -0
- package/dist/utils.d.ts +8 -0
- package/dist/utils.js +18 -0
- package/dist/utils.js.map +1 -0
- package/package.json +6 -6
|
@@ -0,0 +1,1302 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("./setupTests.cjs");
|
|
3
|
+
let _northern_tech_utils_constants = require("@northern.tech/utils/constants");
|
|
4
|
+
//#region src/mockData.ts
|
|
5
|
+
const undefineds = /undefined|\[object Object\]/;
|
|
6
|
+
const menderEnvironment = {
|
|
7
|
+
features: { hasMultitenancy: true },
|
|
8
|
+
integrationVersion: "saas-123.34",
|
|
9
|
+
menderVersion: "next",
|
|
10
|
+
metaMenderVersion: "saas-123.34",
|
|
11
|
+
services: {
|
|
12
|
+
deploymentsVersion: "1.2.3",
|
|
13
|
+
deviceauthVersion: null,
|
|
14
|
+
inventoryVersion: null
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const TEST_SESSION_DATETIME = "2019-01-13T13:00:00.000Z";
|
|
18
|
+
const testDate = new Date(TEST_SESSION_DATETIME);
|
|
19
|
+
const mockDate = new Date(testDate.setMilliseconds(testDate.getMilliseconds() + _northern_tech_utils_constants.maxSessionAge));
|
|
20
|
+
const defaultPassword = "mysecretpassword!123";
|
|
21
|
+
const defaultCreationDate = "2019-01-13T06:25:00.000Z";
|
|
22
|
+
const defaultMacAddress = "dc:a6:32:12:ad:bf";
|
|
23
|
+
const testSsoId = "sso_id";
|
|
24
|
+
const permissionSetObjectTypes = {
|
|
25
|
+
any: "Any",
|
|
26
|
+
artifacts: "Artifacts",
|
|
27
|
+
empty: "",
|
|
28
|
+
groups: "Device groups",
|
|
29
|
+
releases: "Releases",
|
|
30
|
+
tenantManagement: "Tenant management",
|
|
31
|
+
userManagement: "User management"
|
|
32
|
+
};
|
|
33
|
+
const commonEndpoints = {
|
|
34
|
+
artifacts: "^/api/management/v1/deployments/artifacts",
|
|
35
|
+
artifactDetails: "^/api/management/v1/deployments/artifacts/[^/]+",
|
|
36
|
+
deviceManagement: "^/api/management/(v[1-9])/(devauth|inventory)/"
|
|
37
|
+
};
|
|
38
|
+
const token = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJjZTNkMGY4Yy1hZWRlLTQwMzAtYjM5MS03ZDUwMjBlYjg3M2UiLCJzdWIiOiJhMzBhNzgwYi1iODQzLTUzNDQtODBlMy0wZmQ5NWE0ZjZmYzMiLCJleHAiOjE2MDY4MTUzNjksImlhdCI6MTYwNjIxMDU2OSwibWVuZGVyLnRlbmFudCI6IjVmODVjMTdiY2U2MmI3ZmE3ZjVmNzA0MCIsIm1lbmRlci51c2VyIjp0cnVlLCJpc3MiOiJNZW5kZXIgVXNlcnMiLCJzY3AiOiJtZW5kZXIuKiIsIm1lbmRlci5wbGFuIjoicHJvZmVzc2lvbmFsIiwibmJmIjoxNjA2MjEwNTY5fQ.qVgYdCzLTf8OdK9uUctqqaY_HWkIiwpekuGvuGQAXCEgOv4bRNDlZRN_ZRSbxQoARG3pquhScbQrjBV9tcF4irTUPlTn3yrsXNO17DpcbTVeKRkb88RDtIKiRw3orVZ_GlIb-ckTQ5dS-Nqlyyf3Fmrhca-gwt6m_xv2UrmJK6eYYTMfggdRRWb-4u7mEkBI_pHPMTQrT8kJ2BeX-vHgazH9AoH0k85LHtFZQXD7pXHlDZRnLxJXukncwMGDmF17374gavYAIyDIzcC8sEBMDnVXgpikeA1sauzirqix6mAVs6XmxdQO7aF0wfXO1_PTYUA3Nk1oQfMYNlEI3U9uLRJRZIq2L8fmrrBryhstKd4y0KlBbGAQrx8NtRkgajjd1ljMfPBUEZrb7uSerVjneiO-aIBO76CuH0zdklphIjpGJeogkBhe8pAYNggp1XsZHgpZfl7IE5faKaDkMGnutaea--Czor6bhqUNCuY4tR0cpQJbNwy6LS9o1CFy4Log";
|
|
39
|
+
const accessTokens = [{
|
|
40
|
+
id: "some-id-1",
|
|
41
|
+
expiration_date: "2022-06-02T11:11:21.725Z",
|
|
42
|
+
name: "some-name-1"
|
|
43
|
+
}, {
|
|
44
|
+
id: "some-id-2",
|
|
45
|
+
expiration_date: "2022-06-02T11:11:21.725Z",
|
|
46
|
+
last_used: "2022-06-02T11:05:21.725Z",
|
|
47
|
+
name: "some-name-2"
|
|
48
|
+
}];
|
|
49
|
+
const webhookEvents = [{
|
|
50
|
+
id: "1",
|
|
51
|
+
type: "device-status-changed",
|
|
52
|
+
data: {
|
|
53
|
+
id: "1",
|
|
54
|
+
status: "accepted"
|
|
55
|
+
},
|
|
56
|
+
time: "2020-09-01T12:00:00.000Z",
|
|
57
|
+
delivery_statuses: [{
|
|
58
|
+
integration_id: "1",
|
|
59
|
+
success: true,
|
|
60
|
+
status_code: 200
|
|
61
|
+
}]
|
|
62
|
+
}, {
|
|
63
|
+
id: "2",
|
|
64
|
+
type: "device-status-changed",
|
|
65
|
+
data: {
|
|
66
|
+
id: "3",
|
|
67
|
+
status: "accepted"
|
|
68
|
+
},
|
|
69
|
+
time: "2020-09-01T12:00:05.000Z",
|
|
70
|
+
delivery_statuses: [{
|
|
71
|
+
integration_id: "1",
|
|
72
|
+
success: true,
|
|
73
|
+
status_code: 200
|
|
74
|
+
}]
|
|
75
|
+
}];
|
|
76
|
+
const spTenantLimits = {
|
|
77
|
+
max_devices: {
|
|
78
|
+
current_value: 0,
|
|
79
|
+
name: "max_devices",
|
|
80
|
+
tenant_id: "699f07a3e783def54cf6201f",
|
|
81
|
+
value: 200
|
|
82
|
+
},
|
|
83
|
+
max_micro_devices: {
|
|
84
|
+
current_value: 0,
|
|
85
|
+
name: "max_micro_devices",
|
|
86
|
+
tenant_id: "699f07a3e783def54cf6201f",
|
|
87
|
+
value: 280
|
|
88
|
+
},
|
|
89
|
+
max_system_devices: {
|
|
90
|
+
current_value: 0,
|
|
91
|
+
name: "max_system_devices",
|
|
92
|
+
tenant_id: "699f07a3e783def54cf6201f",
|
|
93
|
+
value: 20
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
const tenants = [{
|
|
97
|
+
id: "671a0f1dd58c813118fe8622",
|
|
98
|
+
parent_tenant_id: "6718de64b42e08dea2a2065d",
|
|
99
|
+
name: "child2",
|
|
100
|
+
tenant_token: "mQDYRCr-tGbDuJhPp7fArbfTA5htVTWE9G204AzhDUM",
|
|
101
|
+
status: "active",
|
|
102
|
+
additional_info: {
|
|
103
|
+
marketing: false,
|
|
104
|
+
campaign: ""
|
|
105
|
+
},
|
|
106
|
+
plan: "enterprise",
|
|
107
|
+
trial: false,
|
|
108
|
+
trial_expiration: null,
|
|
109
|
+
service_provider: false,
|
|
110
|
+
created_at: "2024-10-24T09:10:53.281Z",
|
|
111
|
+
cancelled_at: null,
|
|
112
|
+
children_tenants: null,
|
|
113
|
+
max_child_tenants: 0,
|
|
114
|
+
device_count: 0,
|
|
115
|
+
device_limit: 100,
|
|
116
|
+
device_limits: {
|
|
117
|
+
max_devices: {
|
|
118
|
+
current_value: 0,
|
|
119
|
+
name: "max_devices",
|
|
120
|
+
tenant_id: "699f07a3e783def54cf6201f",
|
|
121
|
+
value: 200
|
|
122
|
+
},
|
|
123
|
+
max_micro_devices: {
|
|
124
|
+
current_value: 0,
|
|
125
|
+
name: "max_micro_devices",
|
|
126
|
+
tenant_id: "699f07a3e783def54cf6201f",
|
|
127
|
+
value: 280
|
|
128
|
+
},
|
|
129
|
+
max_system_devices: {
|
|
130
|
+
current_value: 0,
|
|
131
|
+
name: "max_system_devices",
|
|
132
|
+
tenant_id: "699f07a3e783def54cf6201f",
|
|
133
|
+
value: 20
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
binary_delta: true
|
|
137
|
+
}];
|
|
138
|
+
const adminUserCapabilities = {
|
|
139
|
+
canAuditlog: true,
|
|
140
|
+
canConfigure: true,
|
|
141
|
+
canDeploy: true,
|
|
142
|
+
canManageDevices: true,
|
|
143
|
+
canManageReleases: true,
|
|
144
|
+
canManageUsers: true,
|
|
145
|
+
canReadDeployments: true,
|
|
146
|
+
canReadDevices: true,
|
|
147
|
+
canReadReleases: true,
|
|
148
|
+
canReadUsers: true,
|
|
149
|
+
canTroubleshoot: true,
|
|
150
|
+
canUploadReleases: true,
|
|
151
|
+
canWriteDevices: true
|
|
152
|
+
};
|
|
153
|
+
const userId = "a30a780b-b843-5344-80e3-0fd95a4f6fc3";
|
|
154
|
+
const defaultUser = {
|
|
155
|
+
created_ts: "2019-01-01T10:30:00.000Z",
|
|
156
|
+
email: "a@b.com",
|
|
157
|
+
id: "a1",
|
|
158
|
+
roles: ["RBAC_ROLE_PERMIT_ALL"],
|
|
159
|
+
tfa_status: "enabled",
|
|
160
|
+
verified: true
|
|
161
|
+
};
|
|
162
|
+
const deviceTypes = { qemu: "qemux86-64" };
|
|
163
|
+
const checkInTimeRounded = "2019-01-01T00:00:00.000Z";
|
|
164
|
+
const checkInTimeExact = "2019-01-01T10:25:00.000Z";
|
|
165
|
+
const mockApiResponses = {
|
|
166
|
+
deployments: {
|
|
167
|
+
byId: {
|
|
168
|
+
d1: {
|
|
169
|
+
id: "d1",
|
|
170
|
+
name: "test deployment",
|
|
171
|
+
created: "2019-01-01T12:30:00.000Z",
|
|
172
|
+
devices: { a1: {
|
|
173
|
+
id: "a1",
|
|
174
|
+
status: "installing",
|
|
175
|
+
attributes: {},
|
|
176
|
+
image: { size: 123 }
|
|
177
|
+
} },
|
|
178
|
+
statistics: {
|
|
179
|
+
status: {
|
|
180
|
+
"already-installed": 0,
|
|
181
|
+
decommissioned: 0,
|
|
182
|
+
downloading: 0,
|
|
183
|
+
failure: 0,
|
|
184
|
+
installing: 1,
|
|
185
|
+
noartifact: 0,
|
|
186
|
+
pending: 0,
|
|
187
|
+
rebooting: 0,
|
|
188
|
+
success: 0
|
|
189
|
+
},
|
|
190
|
+
total_size: 1234
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
d2: {
|
|
194
|
+
id: "d2",
|
|
195
|
+
name: "test deployment 2",
|
|
196
|
+
artifact_name: "r1",
|
|
197
|
+
artifacts: ["123"],
|
|
198
|
+
created: "2019-01-01T12:25:00.000Z",
|
|
199
|
+
device_count: 1,
|
|
200
|
+
devices: { b1: {
|
|
201
|
+
attributes: {},
|
|
202
|
+
id: "b1",
|
|
203
|
+
status: "pending"
|
|
204
|
+
} },
|
|
205
|
+
filter: void 0,
|
|
206
|
+
group: void 0,
|
|
207
|
+
statistics: { status: {
|
|
208
|
+
downloading: 0,
|
|
209
|
+
decommissioned: 0,
|
|
210
|
+
failure: 0,
|
|
211
|
+
installing: 0,
|
|
212
|
+
noartifact: 0,
|
|
213
|
+
pending: 1,
|
|
214
|
+
rebooting: 0,
|
|
215
|
+
success: 0,
|
|
216
|
+
"already-installed": 0
|
|
217
|
+
} }
|
|
218
|
+
},
|
|
219
|
+
d3: {
|
|
220
|
+
id: "d3",
|
|
221
|
+
name: "Test",
|
|
222
|
+
phases: [
|
|
223
|
+
{
|
|
224
|
+
id: "0",
|
|
225
|
+
batch_size: 2,
|
|
226
|
+
device_count: 2
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
id: "1",
|
|
230
|
+
start_ts: "2019-02-04T11:45:10.002Z",
|
|
231
|
+
batch_size: 3,
|
|
232
|
+
device_count: 3
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
id: "2",
|
|
236
|
+
start_ts: "2019-02-05T11:45:10.002Z",
|
|
237
|
+
batch_size: 5,
|
|
238
|
+
device_count: 5
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
id: "3",
|
|
242
|
+
start_ts: "2019-02-06T11:45:10.002Z",
|
|
243
|
+
batch_size: 5,
|
|
244
|
+
device_count: 5
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
id: "4",
|
|
248
|
+
start_ts: "2019-02-21T11:45:10.002Z",
|
|
249
|
+
batch_size: 5,
|
|
250
|
+
device_count: 0
|
|
251
|
+
}
|
|
252
|
+
],
|
|
253
|
+
max_devices: 0,
|
|
254
|
+
created: "2019-01-31T12:59:30.020Z",
|
|
255
|
+
devices: {},
|
|
256
|
+
filter: void 0,
|
|
257
|
+
group: void 0,
|
|
258
|
+
stats: {
|
|
259
|
+
pending: 3,
|
|
260
|
+
decommissioned: 0,
|
|
261
|
+
failure: 23,
|
|
262
|
+
pause_before_committing: 0,
|
|
263
|
+
pause_before_rebooting: 0,
|
|
264
|
+
installing: 0,
|
|
265
|
+
rebooting: 0,
|
|
266
|
+
"already-installed": 0,
|
|
267
|
+
pause_before_installing: 0,
|
|
268
|
+
downloading: 0,
|
|
269
|
+
success: 6,
|
|
270
|
+
aborted: 0,
|
|
271
|
+
noartifact: 0
|
|
272
|
+
},
|
|
273
|
+
statistics: { total_size: "1234" },
|
|
274
|
+
status: "inprogress",
|
|
275
|
+
active: true,
|
|
276
|
+
device_count: 100,
|
|
277
|
+
retries: "0",
|
|
278
|
+
type: "software"
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
byStatus: {
|
|
282
|
+
pending: { deploymentIds: ["d2"] },
|
|
283
|
+
inprogress: { deploymentIds: ["d3"] }
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
devices: {
|
|
287
|
+
byId: {
|
|
288
|
+
a1: {
|
|
289
|
+
id: "a1",
|
|
290
|
+
auth_sets: [{
|
|
291
|
+
id: "auth1",
|
|
292
|
+
identity_data: { mac: defaultMacAddress },
|
|
293
|
+
pubkey: "-----BEGIN PUBLIC KEY-----\nMIIBojWELzgJ62hcXIhAfqfoNiaB1326XZByZwcnHr5BuSPAgMBAAE=\n-----END PUBLIC KEY-----\n",
|
|
294
|
+
status: "accepted",
|
|
295
|
+
ts: defaultCreationDate
|
|
296
|
+
}],
|
|
297
|
+
updated_ts: "2019-01-01T09:25:00.000Z"
|
|
298
|
+
},
|
|
299
|
+
b1: {
|
|
300
|
+
id: "b1",
|
|
301
|
+
attributes: {
|
|
302
|
+
ipv4_wlan0: "192.168.10.141/24",
|
|
303
|
+
device_type: [deviceTypes.qemu]
|
|
304
|
+
},
|
|
305
|
+
system: { check_in_time: checkInTimeRounded },
|
|
306
|
+
check_in_time: checkInTimeExact,
|
|
307
|
+
check_in_time_exact: checkInTimeExact,
|
|
308
|
+
check_in_time_rounded: checkInTimeRounded,
|
|
309
|
+
identity_data: { mac: defaultMacAddress },
|
|
310
|
+
status: "accepted",
|
|
311
|
+
decommissioning: false,
|
|
312
|
+
created_ts: defaultCreationDate,
|
|
313
|
+
updated_ts: "2019-01-01T09:25:00.000Z",
|
|
314
|
+
auth_sets: [{
|
|
315
|
+
id: "auth1",
|
|
316
|
+
identity_data: { mac: defaultMacAddress },
|
|
317
|
+
pubkey: "-----BEGIN PUBLIC KEY-----\nMIIBojWELzgJ62hcXIhAfqfoNiaB1326XZByZwcnHr5BuSPAgMBAAE=\n-----END PUBLIC KEY-----\n",
|
|
318
|
+
ts: defaultCreationDate,
|
|
319
|
+
status: "accepted"
|
|
320
|
+
}]
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
groups: { byId: {
|
|
324
|
+
testGroup: {
|
|
325
|
+
deviceIds: ["a1", "b1"],
|
|
326
|
+
filters: [],
|
|
327
|
+
total: 2
|
|
328
|
+
},
|
|
329
|
+
testGroupDynamic: {
|
|
330
|
+
id: "filter1",
|
|
331
|
+
name: "filter1",
|
|
332
|
+
filters: [{
|
|
333
|
+
scope: "system",
|
|
334
|
+
key: "group",
|
|
335
|
+
operator: "$eq",
|
|
336
|
+
value: "things"
|
|
337
|
+
}]
|
|
338
|
+
}
|
|
339
|
+
} },
|
|
340
|
+
limits: {
|
|
341
|
+
standard: 500,
|
|
342
|
+
micro: 0,
|
|
343
|
+
system: 0
|
|
344
|
+
},
|
|
345
|
+
byStatus: {
|
|
346
|
+
accepted: {
|
|
347
|
+
deviceIds: ["a1", "b1"],
|
|
348
|
+
total: 2
|
|
349
|
+
},
|
|
350
|
+
active: {
|
|
351
|
+
deviceIds: [],
|
|
352
|
+
total: 0
|
|
353
|
+
},
|
|
354
|
+
inactive: {
|
|
355
|
+
deviceIds: [],
|
|
356
|
+
total: 0
|
|
357
|
+
},
|
|
358
|
+
pending: {
|
|
359
|
+
deviceIds: ["c1"],
|
|
360
|
+
total: 1
|
|
361
|
+
},
|
|
362
|
+
preauthorized: {
|
|
363
|
+
deviceIds: [],
|
|
364
|
+
total: 0
|
|
365
|
+
},
|
|
366
|
+
rejected: {
|
|
367
|
+
deviceIds: [],
|
|
368
|
+
total: 0
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
organization: {
|
|
373
|
+
organization: {
|
|
374
|
+
id: "1",
|
|
375
|
+
addons: [],
|
|
376
|
+
name: "test",
|
|
377
|
+
plan: "os",
|
|
378
|
+
trial: false
|
|
379
|
+
},
|
|
380
|
+
products: [{
|
|
381
|
+
name: "mender_standard",
|
|
382
|
+
billing_unit: "devices",
|
|
383
|
+
prices: [{
|
|
384
|
+
plan: "os",
|
|
385
|
+
constraints: {
|
|
386
|
+
min: 50,
|
|
387
|
+
max: 1e3,
|
|
388
|
+
div: 50
|
|
389
|
+
}
|
|
390
|
+
}, {
|
|
391
|
+
plan: "professional",
|
|
392
|
+
constraints: {
|
|
393
|
+
min: 250,
|
|
394
|
+
max: 1e4,
|
|
395
|
+
div: 50
|
|
396
|
+
}
|
|
397
|
+
}],
|
|
398
|
+
addons: [
|
|
399
|
+
{
|
|
400
|
+
name: "troubleshoot",
|
|
401
|
+
prices: [{ plan: "os" }, { plan: "professional" }]
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
name: "configure",
|
|
405
|
+
prices: [{ plan: "os" }, { plan: "professional" }]
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
name: "monitor",
|
|
409
|
+
prices: [{ plan: "professional" }]
|
|
410
|
+
}
|
|
411
|
+
]
|
|
412
|
+
}, {
|
|
413
|
+
name: "mender_micro",
|
|
414
|
+
billing_unit: "devices",
|
|
415
|
+
prices: [{
|
|
416
|
+
plan: "os",
|
|
417
|
+
constraints: {
|
|
418
|
+
min: 50,
|
|
419
|
+
max: 5e3,
|
|
420
|
+
div: 50
|
|
421
|
+
}
|
|
422
|
+
}, {
|
|
423
|
+
plan: "professional",
|
|
424
|
+
constraints: {
|
|
425
|
+
min: 500,
|
|
426
|
+
max: 1e5,
|
|
427
|
+
div: 50
|
|
428
|
+
}
|
|
429
|
+
}]
|
|
430
|
+
}],
|
|
431
|
+
intentId: "testIntent",
|
|
432
|
+
auditlog: { events: [
|
|
433
|
+
{
|
|
434
|
+
actor: {
|
|
435
|
+
id: "string",
|
|
436
|
+
type: "user",
|
|
437
|
+
email: "string@example.com"
|
|
438
|
+
},
|
|
439
|
+
time: "2019-01-01T12:10:22.667Z",
|
|
440
|
+
action: "create",
|
|
441
|
+
object: {
|
|
442
|
+
id: "string",
|
|
443
|
+
type: "user",
|
|
444
|
+
user: { email: "user@acme.com" }
|
|
445
|
+
},
|
|
446
|
+
change: "change1"
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
actor: {
|
|
450
|
+
id: "string",
|
|
451
|
+
type: "user",
|
|
452
|
+
email: "string",
|
|
453
|
+
identity_data: "string"
|
|
454
|
+
},
|
|
455
|
+
time: "2019-01-01T12:16:22.667Z",
|
|
456
|
+
action: "create",
|
|
457
|
+
object: {
|
|
458
|
+
id: "string",
|
|
459
|
+
type: "deployment",
|
|
460
|
+
deployment: {
|
|
461
|
+
name: "production",
|
|
462
|
+
artifact_name: "Application 0.0.1"
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
change: "change2"
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
actor: {
|
|
469
|
+
id: "string",
|
|
470
|
+
type: "user",
|
|
471
|
+
email: "string@example.com"
|
|
472
|
+
},
|
|
473
|
+
time: "2019-01-01T12:10:22.669Z",
|
|
474
|
+
action: "open_terminal",
|
|
475
|
+
meta: { session_id: ["abd313a8-ee88-48ab-9c99-fbcd80048e6e"] },
|
|
476
|
+
object: {
|
|
477
|
+
id: "a1",
|
|
478
|
+
type: "device"
|
|
479
|
+
},
|
|
480
|
+
change: "change3"
|
|
481
|
+
}
|
|
482
|
+
] }
|
|
483
|
+
},
|
|
484
|
+
releases: { byId: { r1: {
|
|
485
|
+
name: "r1",
|
|
486
|
+
artifacts: [{
|
|
487
|
+
id: "art1",
|
|
488
|
+
description: "test description",
|
|
489
|
+
device_types_compatible: [deviceTypes.qemu],
|
|
490
|
+
modified: "2020-09-10T12:16:22.667Z",
|
|
491
|
+
updates: [{ type_info: { type: "testtype" } }],
|
|
492
|
+
artifact_depends: { device_type: [deviceTypes.qemu] },
|
|
493
|
+
artifact_provides: {
|
|
494
|
+
artifact_name: "myapp",
|
|
495
|
+
"data-partition.myapp.version": "v2020.10",
|
|
496
|
+
list_of_fancy: [deviceTypes.qemu, "x172"]
|
|
497
|
+
},
|
|
498
|
+
clears_artifact_provides: ["data-partition.myapp.*"]
|
|
499
|
+
}],
|
|
500
|
+
device_types_compatible: [deviceTypes.qemu],
|
|
501
|
+
modified: "2020-09-10T12:16:22.667Z",
|
|
502
|
+
metaData: {}
|
|
503
|
+
} } },
|
|
504
|
+
users: {
|
|
505
|
+
byId: {
|
|
506
|
+
a1: defaultUser,
|
|
507
|
+
[userId]: {
|
|
508
|
+
...defaultUser,
|
|
509
|
+
id: userId,
|
|
510
|
+
email: "a2@b.com",
|
|
511
|
+
created_ts: "2019-01-01T12:30:00.000Z"
|
|
512
|
+
}
|
|
513
|
+
},
|
|
514
|
+
rolesById: {
|
|
515
|
+
admin: {
|
|
516
|
+
name: "admin",
|
|
517
|
+
description: "Administrator role",
|
|
518
|
+
permissions: []
|
|
519
|
+
},
|
|
520
|
+
test: {
|
|
521
|
+
name: "test",
|
|
522
|
+
description: "test description",
|
|
523
|
+
permissions: []
|
|
524
|
+
}
|
|
525
|
+
},
|
|
526
|
+
globalSettings: {
|
|
527
|
+
"2fa": "enabled",
|
|
528
|
+
id_attribute: void 0,
|
|
529
|
+
previousFilters: []
|
|
530
|
+
},
|
|
531
|
+
userSettings: {
|
|
532
|
+
"2fa": "disabled",
|
|
533
|
+
columnSelection: [],
|
|
534
|
+
onboarding: { something: "here" },
|
|
535
|
+
tooltips: {},
|
|
536
|
+
previousFilters: []
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
const releasesList = Array.from({ length: 5e3 }, (x, i) => ({
|
|
541
|
+
artifacts: [{
|
|
542
|
+
id: "art1",
|
|
543
|
+
description: "test description",
|
|
544
|
+
device_types_compatible: [deviceTypes.qemu],
|
|
545
|
+
modified: "2020-09-10T12:16:22.667Z",
|
|
546
|
+
updates: [{ type_info: { type: "testtype" } }],
|
|
547
|
+
artifact_depends: { device_type: [deviceTypes.qemu] },
|
|
548
|
+
artifact_provides: {
|
|
549
|
+
artifact_name: "myapp",
|
|
550
|
+
"data-partition.myapp.version": "v2020.10",
|
|
551
|
+
list_of_fancy: [deviceTypes.qemu, "x172"]
|
|
552
|
+
},
|
|
553
|
+
clears_artifact_provides: ["data-partition.myapp.*"]
|
|
554
|
+
}],
|
|
555
|
+
device_types_compatible: [deviceTypes.qemu],
|
|
556
|
+
metaData: {},
|
|
557
|
+
name: `release-${i + 1}`,
|
|
558
|
+
modified: i
|
|
559
|
+
}));
|
|
560
|
+
const permissionSets = [
|
|
561
|
+
{
|
|
562
|
+
..._northern_tech_utils_constants.defaultPermissionSets.Basic,
|
|
563
|
+
object: permissionSetObjectTypes.empty,
|
|
564
|
+
description: "Set containing basic permissions.",
|
|
565
|
+
permissions: [
|
|
566
|
+
{
|
|
567
|
+
action: "http",
|
|
568
|
+
object: {
|
|
569
|
+
type: "any",
|
|
570
|
+
value: "^/api/management/v1/useradm/settings$"
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
action: "http",
|
|
575
|
+
object: {
|
|
576
|
+
type: "any",
|
|
577
|
+
value: "^/api/management/v1/useradm/users/me$"
|
|
578
|
+
}
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
action: "http",
|
|
582
|
+
object: {
|
|
583
|
+
type: "any",
|
|
584
|
+
value: "^/api/management/1.0/auth/verify$"
|
|
585
|
+
}
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
action: "http",
|
|
589
|
+
object: {
|
|
590
|
+
type: "PUT",
|
|
591
|
+
value: "^/api/management/v1/useradm/2faverify$"
|
|
592
|
+
}
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
action: "http",
|
|
596
|
+
object: {
|
|
597
|
+
type: "POST",
|
|
598
|
+
value: "^/api/management/v1/useradm/users/me/2fa/(enable|disable)$"
|
|
599
|
+
}
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
action: "http",
|
|
603
|
+
object: {
|
|
604
|
+
type: "GET",
|
|
605
|
+
value: "^/api/management/(v[1-9])/useradm/roles"
|
|
606
|
+
}
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
action: "http",
|
|
610
|
+
object: {
|
|
611
|
+
type: "GET",
|
|
612
|
+
value: "^/api/management/(v[1-9])/tenantadm/user/tenant"
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
]
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
..._northern_tech_utils_constants.defaultPermissionSets.ManageReleases,
|
|
619
|
+
action: _northern_tech_utils_constants.uiPermissionsById.manage.title,
|
|
620
|
+
object: permissionSetObjectTypes.releases,
|
|
621
|
+
description: "Set of permissions which allows user to manage releases",
|
|
622
|
+
permissions: [
|
|
623
|
+
{
|
|
624
|
+
action: "http",
|
|
625
|
+
object: {
|
|
626
|
+
type: "GET",
|
|
627
|
+
value: commonEndpoints.artifacts
|
|
628
|
+
}
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
action: "http",
|
|
632
|
+
object: {
|
|
633
|
+
type: "GET",
|
|
634
|
+
value: commonEndpoints.artifactDetails
|
|
635
|
+
}
|
|
636
|
+
},
|
|
637
|
+
{
|
|
638
|
+
action: "http",
|
|
639
|
+
object: {
|
|
640
|
+
type: "PUT",
|
|
641
|
+
value: commonEndpoints.artifactDetails
|
|
642
|
+
}
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
action: "http",
|
|
646
|
+
object: {
|
|
647
|
+
type: "DELETE",
|
|
648
|
+
value: commonEndpoints.artifactDetails
|
|
649
|
+
}
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
action: "http",
|
|
653
|
+
object: {
|
|
654
|
+
type: "GET",
|
|
655
|
+
value: "^/api/management/v1/deployments/artifacts/[^/]+/download"
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
]
|
|
659
|
+
},
|
|
660
|
+
{
|
|
661
|
+
..._northern_tech_utils_constants.defaultPermissionSets.ReadUsers,
|
|
662
|
+
action: _northern_tech_utils_constants.uiPermissionsById.read.title,
|
|
663
|
+
object: permissionSetObjectTypes.userManagement,
|
|
664
|
+
description: "Set of permissions which allows user to view other users",
|
|
665
|
+
permissions: [{
|
|
666
|
+
action: "http",
|
|
667
|
+
object: {
|
|
668
|
+
type: "GET",
|
|
669
|
+
value: "^/api/management/(v[1-9])/useradm/"
|
|
670
|
+
}
|
|
671
|
+
}]
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
..._northern_tech_utils_constants.defaultPermissionSets.ManageUsers,
|
|
675
|
+
action: _northern_tech_utils_constants.uiPermissionsById.manage.title,
|
|
676
|
+
object: permissionSetObjectTypes.userManagement,
|
|
677
|
+
description: "Set of permissions which allows user manage other user accounts",
|
|
678
|
+
permissions: [{
|
|
679
|
+
action: "http",
|
|
680
|
+
object: {
|
|
681
|
+
type: "any",
|
|
682
|
+
value: "^/api/management/(v[1-9])/useradm/"
|
|
683
|
+
}
|
|
684
|
+
}]
|
|
685
|
+
},
|
|
686
|
+
{
|
|
687
|
+
..._northern_tech_utils_constants.defaultPermissionSets.ReadTenants,
|
|
688
|
+
action: _northern_tech_utils_constants.uiPermissionsById.read.title,
|
|
689
|
+
object: permissionSetObjectTypes.tenantManagement,
|
|
690
|
+
description: "Set of permissions which allows user to list other tenants and their config",
|
|
691
|
+
permissions: [{
|
|
692
|
+
action: "http",
|
|
693
|
+
object: {
|
|
694
|
+
type: "GET",
|
|
695
|
+
value: "^/api/management/(v[1-9])/tenantadm/"
|
|
696
|
+
}
|
|
697
|
+
}, {
|
|
698
|
+
action: "http",
|
|
699
|
+
object: {
|
|
700
|
+
type: "POST",
|
|
701
|
+
value: "^/api/management/(v[1-9])/tenantadm/"
|
|
702
|
+
}
|
|
703
|
+
}]
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
..._northern_tech_utils_constants.defaultPermissionSets.ManageTenants,
|
|
707
|
+
action: _northern_tech_utils_constants.uiPermissionsById.manage.title,
|
|
708
|
+
object: permissionSetObjectTypes.tenantManagement,
|
|
709
|
+
description: "Set of permissions which allows user to manage other tenants and their config",
|
|
710
|
+
permissions: [
|
|
711
|
+
{
|
|
712
|
+
action: "http",
|
|
713
|
+
object: {
|
|
714
|
+
type: "GET",
|
|
715
|
+
value: "^/api/management/(v[1-9])/tenantadm/"
|
|
716
|
+
}
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
action: "http",
|
|
720
|
+
object: {
|
|
721
|
+
type: "POST",
|
|
722
|
+
value: "^/api/management/(v[1-9])/tenantadm/"
|
|
723
|
+
}
|
|
724
|
+
},
|
|
725
|
+
{
|
|
726
|
+
action: "http",
|
|
727
|
+
object: {
|
|
728
|
+
type: "PUT",
|
|
729
|
+
value: "^/api/management/(v[1-9])/tenantadm/"
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
]
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
..._northern_tech_utils_constants.defaultPermissionSets.ReadAuditLogs,
|
|
736
|
+
action: _northern_tech_utils_constants.uiPermissionsById.read.title,
|
|
737
|
+
object: "System Audit Log",
|
|
738
|
+
description: "Set of permissions which allows user to view system audit log",
|
|
739
|
+
permissions: [{
|
|
740
|
+
action: "http",
|
|
741
|
+
object: {
|
|
742
|
+
type: "GET",
|
|
743
|
+
value: "^/api/management/(v[1-9]|0.1.0)/auditlogs/logs"
|
|
744
|
+
}
|
|
745
|
+
}]
|
|
746
|
+
},
|
|
747
|
+
{
|
|
748
|
+
..._northern_tech_utils_constants.defaultPermissionSets.DeployToDevices,
|
|
749
|
+
action: "Deploy",
|
|
750
|
+
object: permissionSetObjectTypes.groups,
|
|
751
|
+
description: "Set of permissions which allows user to deploy to devices",
|
|
752
|
+
permissions: [{
|
|
753
|
+
action: "http",
|
|
754
|
+
object: {
|
|
755
|
+
type: "any",
|
|
756
|
+
value: "^/api/management/(v[1-9])/(deployments|deviceconfig)/"
|
|
757
|
+
}
|
|
758
|
+
}],
|
|
759
|
+
supported_scope_types: [_northern_tech_utils_constants.scopedPermissionAreas.groups.scopeType]
|
|
760
|
+
},
|
|
761
|
+
{
|
|
762
|
+
..._northern_tech_utils_constants.defaultPermissionSets.ConfigureDevices,
|
|
763
|
+
action: "Configure",
|
|
764
|
+
object: permissionSetObjectTypes.groups,
|
|
765
|
+
description: "Set of permissions which allows user to manage configuration of the devices",
|
|
766
|
+
permissions: [{
|
|
767
|
+
action: "http",
|
|
768
|
+
object: {
|
|
769
|
+
type: "any",
|
|
770
|
+
value: "^/api/management/(v[1-9])/deviceconfig/"
|
|
771
|
+
}
|
|
772
|
+
}],
|
|
773
|
+
supported_scope_types: [_northern_tech_utils_constants.scopedPermissionAreas.groups.scopeType]
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
..._northern_tech_utils_constants.defaultPermissionSets.ConnectToDevices,
|
|
777
|
+
action: "Connect",
|
|
778
|
+
object: permissionSetObjectTypes.groups,
|
|
779
|
+
description: "Set of permissions which allows user to use remote terminal and file transfer",
|
|
780
|
+
permissions: [
|
|
781
|
+
{
|
|
782
|
+
action: "http",
|
|
783
|
+
object: {
|
|
784
|
+
type: "GET",
|
|
785
|
+
value: "^/api/management/(v[1-9]|0.1.0)/deviceconnect/devices/[^/]+/connect$"
|
|
786
|
+
}
|
|
787
|
+
},
|
|
788
|
+
{
|
|
789
|
+
action: "http",
|
|
790
|
+
object: {
|
|
791
|
+
type: "GET",
|
|
792
|
+
value: "^/api/management/(v[1-9]|0.1.0)/deviceconnect/devices/[^/]+/download\\?path=[^&]+$"
|
|
793
|
+
}
|
|
794
|
+
},
|
|
795
|
+
{
|
|
796
|
+
action: "http",
|
|
797
|
+
object: {
|
|
798
|
+
type: "PUT",
|
|
799
|
+
value: "^/api/management/(v[1-9]|0.1.0)/deviceconnect/devices/[^/]+/upload$"
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
],
|
|
803
|
+
supported_scope_types: [_northern_tech_utils_constants.scopedPermissionAreas.groups.scopeType]
|
|
804
|
+
},
|
|
805
|
+
{
|
|
806
|
+
..._northern_tech_utils_constants.defaultPermissionSets.SuperUser,
|
|
807
|
+
action: "Any",
|
|
808
|
+
object: permissionSetObjectTypes.any,
|
|
809
|
+
description: "Set of permissions which allows user to do anything",
|
|
810
|
+
permissions: [{
|
|
811
|
+
action: "any",
|
|
812
|
+
object: {
|
|
813
|
+
type: "any",
|
|
814
|
+
value: "any"
|
|
815
|
+
}
|
|
816
|
+
}]
|
|
817
|
+
},
|
|
818
|
+
{
|
|
819
|
+
..._northern_tech_utils_constants.defaultPermissionSets.UploadArtifacts,
|
|
820
|
+
action: "Upload",
|
|
821
|
+
object: permissionSetObjectTypes.artifacts,
|
|
822
|
+
description: "Set of permissions which allows user to upload artifacts",
|
|
823
|
+
permissions: [{
|
|
824
|
+
action: "http",
|
|
825
|
+
object: {
|
|
826
|
+
type: "POST",
|
|
827
|
+
value: commonEndpoints.artifacts
|
|
828
|
+
}
|
|
829
|
+
}, {
|
|
830
|
+
action: "http",
|
|
831
|
+
object: {
|
|
832
|
+
type: "POST",
|
|
833
|
+
value: "^/api/management/v1/deployments/artifacts/generate"
|
|
834
|
+
}
|
|
835
|
+
}]
|
|
836
|
+
},
|
|
837
|
+
{
|
|
838
|
+
..._northern_tech_utils_constants.defaultPermissionSets.ReadDevices,
|
|
839
|
+
action: _northern_tech_utils_constants.uiPermissionsById.read.title,
|
|
840
|
+
object: permissionSetObjectTypes.groups,
|
|
841
|
+
description: "Set of permissions which allows user to view devices",
|
|
842
|
+
permissions: [
|
|
843
|
+
{
|
|
844
|
+
action: "http",
|
|
845
|
+
object: {
|
|
846
|
+
type: "POST",
|
|
847
|
+
value: "^/api/management/v2/inventory/filters/search"
|
|
848
|
+
}
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
action: "http",
|
|
852
|
+
object: {
|
|
853
|
+
type: "GET",
|
|
854
|
+
value: "^/api/management/(v[1-9])/(deployments|devauth|inventory|deviceconfig|devicemonitor)/"
|
|
855
|
+
}
|
|
856
|
+
},
|
|
857
|
+
{
|
|
858
|
+
action: "http",
|
|
859
|
+
object: {
|
|
860
|
+
type: "GET",
|
|
861
|
+
value: "^/api/management/(v[1-9]|0.1.0)/deviceconnect/devices/[^/]+$"
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
],
|
|
865
|
+
supported_scope_types: [_northern_tech_utils_constants.scopedPermissionAreas.groups.scopeType]
|
|
866
|
+
},
|
|
867
|
+
{
|
|
868
|
+
..._northern_tech_utils_constants.defaultPermissionSets.ManageDevices,
|
|
869
|
+
action: _northern_tech_utils_constants.uiPermissionsById.manage.title,
|
|
870
|
+
object: permissionSetObjectTypes.groups,
|
|
871
|
+
description: "Set of permissions which allows user to manage devices",
|
|
872
|
+
permissions: [
|
|
873
|
+
{
|
|
874
|
+
action: "http",
|
|
875
|
+
object: {
|
|
876
|
+
type: "POST",
|
|
877
|
+
value: commonEndpoints.deviceManagement
|
|
878
|
+
}
|
|
879
|
+
},
|
|
880
|
+
{
|
|
881
|
+
action: "http",
|
|
882
|
+
object: {
|
|
883
|
+
type: "PUT",
|
|
884
|
+
value: commonEndpoints.deviceManagement
|
|
885
|
+
}
|
|
886
|
+
},
|
|
887
|
+
{
|
|
888
|
+
action: "http",
|
|
889
|
+
object: {
|
|
890
|
+
type: "DELETE",
|
|
891
|
+
value: commonEndpoints.deviceManagement
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
],
|
|
895
|
+
supported_scope_types: [_northern_tech_utils_constants.scopedPermissionAreas.groups.scopeType]
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
..._northern_tech_utils_constants.defaultPermissionSets.ReadReleases,
|
|
899
|
+
action: _northern_tech_utils_constants.uiPermissionsById.read.title,
|
|
900
|
+
object: permissionSetObjectTypes.releases,
|
|
901
|
+
description: "Set of permissions which allows user to view releases",
|
|
902
|
+
permissions: [
|
|
903
|
+
{
|
|
904
|
+
action: "http",
|
|
905
|
+
object: {
|
|
906
|
+
type: "GET",
|
|
907
|
+
value: commonEndpoints.artifacts
|
|
908
|
+
}
|
|
909
|
+
},
|
|
910
|
+
{
|
|
911
|
+
action: "http",
|
|
912
|
+
object: {
|
|
913
|
+
type: "GET",
|
|
914
|
+
value: commonEndpoints.artifactDetails
|
|
915
|
+
}
|
|
916
|
+
},
|
|
917
|
+
{
|
|
918
|
+
action: "http",
|
|
919
|
+
object: {
|
|
920
|
+
type: "GET",
|
|
921
|
+
value: "^/api/management/v1/deployments/artifacts/[^/]+/download"
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
]
|
|
925
|
+
},
|
|
926
|
+
{
|
|
927
|
+
name: "almostAdmin",
|
|
928
|
+
object: permissionSetObjectTypes.empty,
|
|
929
|
+
description: "Set containing all the permissions.",
|
|
930
|
+
permissions: [
|
|
931
|
+
{
|
|
932
|
+
action: "http",
|
|
933
|
+
object: {
|
|
934
|
+
type: "any",
|
|
935
|
+
value: "^/api/management/(v[1-9])/auditlogs/.*"
|
|
936
|
+
}
|
|
937
|
+
},
|
|
938
|
+
{
|
|
939
|
+
action: "http",
|
|
940
|
+
object: {
|
|
941
|
+
type: "any",
|
|
942
|
+
value: "^/api/management/(v[1-9])/deployments/.*"
|
|
943
|
+
}
|
|
944
|
+
},
|
|
945
|
+
{
|
|
946
|
+
action: "http",
|
|
947
|
+
object: {
|
|
948
|
+
type: "any",
|
|
949
|
+
value: "^/api/management/(v[1-9])/deployments/config/.*"
|
|
950
|
+
}
|
|
951
|
+
},
|
|
952
|
+
{
|
|
953
|
+
action: "http",
|
|
954
|
+
object: {
|
|
955
|
+
type: "any",
|
|
956
|
+
value: "^/api/management/(v[1-9])/deployments/deployments/.*"
|
|
957
|
+
}
|
|
958
|
+
},
|
|
959
|
+
{
|
|
960
|
+
action: "http",
|
|
961
|
+
object: {
|
|
962
|
+
type: "any",
|
|
963
|
+
value: "^/api/management/(v[1-9])/deployments/deployments/releases/.*"
|
|
964
|
+
}
|
|
965
|
+
},
|
|
966
|
+
{
|
|
967
|
+
action: "http",
|
|
968
|
+
object: {
|
|
969
|
+
type: "any",
|
|
970
|
+
value: "^/api/management/(v[1-9])/devauth/.*"
|
|
971
|
+
}
|
|
972
|
+
},
|
|
973
|
+
{
|
|
974
|
+
action: "http",
|
|
975
|
+
object: {
|
|
976
|
+
type: "any",
|
|
977
|
+
value: "^/api/management/(v[1-9])/deviceconfig/.*"
|
|
978
|
+
}
|
|
979
|
+
},
|
|
980
|
+
{
|
|
981
|
+
action: "http",
|
|
982
|
+
object: {
|
|
983
|
+
type: "any",
|
|
984
|
+
value: "^/api/management/(v[1-9])/deviceconnect/.*"
|
|
985
|
+
}
|
|
986
|
+
},
|
|
987
|
+
{
|
|
988
|
+
action: "http",
|
|
989
|
+
object: {
|
|
990
|
+
type: "any",
|
|
991
|
+
value: "^/api/management/(v[1-9])/deviceconnect/devices"
|
|
992
|
+
}
|
|
993
|
+
},
|
|
994
|
+
{
|
|
995
|
+
action: "http",
|
|
996
|
+
object: {
|
|
997
|
+
type: "any",
|
|
998
|
+
value: "^/api/management/(v[1-9])/inventory/.*"
|
|
999
|
+
}
|
|
1000
|
+
},
|
|
1001
|
+
{
|
|
1002
|
+
action: "http",
|
|
1003
|
+
object: {
|
|
1004
|
+
type: "any",
|
|
1005
|
+
value: "^/api/management/(v[1-9])/iot-manager/.*"
|
|
1006
|
+
}
|
|
1007
|
+
},
|
|
1008
|
+
{
|
|
1009
|
+
action: "http",
|
|
1010
|
+
object: {
|
|
1011
|
+
type: "any",
|
|
1012
|
+
value: "^/api/management/(v[1-9])/monitor/.*"
|
|
1013
|
+
}
|
|
1014
|
+
},
|
|
1015
|
+
{
|
|
1016
|
+
action: "http",
|
|
1017
|
+
object: {
|
|
1018
|
+
type: "any",
|
|
1019
|
+
value: "^/api/management/(v[1-9])/useradm/.*"
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
]
|
|
1023
|
+
}
|
|
1024
|
+
];
|
|
1025
|
+
const rbacRoles = [
|
|
1026
|
+
{
|
|
1027
|
+
name: "dyn",
|
|
1028
|
+
description: "",
|
|
1029
|
+
permissions: [{
|
|
1030
|
+
action: "CREATE_DEPLOYMENT",
|
|
1031
|
+
object: {
|
|
1032
|
+
type: "DEVICE_GROUP",
|
|
1033
|
+
value: "dyn"
|
|
1034
|
+
}
|
|
1035
|
+
}, {
|
|
1036
|
+
action: "VIEW_DEVICE",
|
|
1037
|
+
object: {
|
|
1038
|
+
type: "DEVICE_GROUP",
|
|
1039
|
+
value: "dyn"
|
|
1040
|
+
}
|
|
1041
|
+
}]
|
|
1042
|
+
},
|
|
1043
|
+
{
|
|
1044
|
+
name: "asdasd",
|
|
1045
|
+
description: "123",
|
|
1046
|
+
permissions: [{
|
|
1047
|
+
action: "http",
|
|
1048
|
+
object: {
|
|
1049
|
+
type: "any",
|
|
1050
|
+
value: "/api/management/v1/useradm/.*"
|
|
1051
|
+
}
|
|
1052
|
+
}]
|
|
1053
|
+
},
|
|
1054
|
+
{
|
|
1055
|
+
name: "141sasd",
|
|
1056
|
+
description: "1313adg",
|
|
1057
|
+
permission_sets_with_scope: [
|
|
1058
|
+
{
|
|
1059
|
+
..._northern_tech_utils_constants.defaultPermissionSets.ReadDevices,
|
|
1060
|
+
scope: {
|
|
1061
|
+
type: _northern_tech_utils_constants.scopedPermissionAreas.groups.scopeType,
|
|
1062
|
+
value: ["bestgroup"]
|
|
1063
|
+
}
|
|
1064
|
+
},
|
|
1065
|
+
{
|
|
1066
|
+
..._northern_tech_utils_constants.defaultPermissionSets.ConnectToDevices,
|
|
1067
|
+
scope: {
|
|
1068
|
+
type: _northern_tech_utils_constants.scopedPermissionAreas.groups.scopeType,
|
|
1069
|
+
value: ["bestgroup"]
|
|
1070
|
+
}
|
|
1071
|
+
},
|
|
1072
|
+
{ ..._northern_tech_utils_constants.defaultPermissionSets.ManageUsers }
|
|
1073
|
+
]
|
|
1074
|
+
},
|
|
1075
|
+
{
|
|
1076
|
+
name: "kljlkk",
|
|
1077
|
+
description: "lkl",
|
|
1078
|
+
permission_sets_with_scope: [{
|
|
1079
|
+
..._northern_tech_utils_constants.defaultPermissionSets.ConnectToDevices,
|
|
1080
|
+
scope: {
|
|
1081
|
+
type: _northern_tech_utils_constants.scopedPermissionAreas.groups.scopeType,
|
|
1082
|
+
value: ["bestgroup"]
|
|
1083
|
+
}
|
|
1084
|
+
}]
|
|
1085
|
+
},
|
|
1086
|
+
{
|
|
1087
|
+
name: "yyyyy",
|
|
1088
|
+
description: "asd",
|
|
1089
|
+
permission_sets_with_scope: [{
|
|
1090
|
+
..._northern_tech_utils_constants.defaultPermissionSets.ManageDevices,
|
|
1091
|
+
scope: {
|
|
1092
|
+
type: _northern_tech_utils_constants.scopedPermissionAreas.groups.scopeType,
|
|
1093
|
+
value: ["dockerclient"]
|
|
1094
|
+
}
|
|
1095
|
+
}, { ..._northern_tech_utils_constants.defaultPermissionSets.ManageReleases }]
|
|
1096
|
+
},
|
|
1097
|
+
{
|
|
1098
|
+
name: "RBAC_ROLE_DEPLOYMENTS_MANAGER",
|
|
1099
|
+
description: "Intended for users responsible for managing deployments, this role can create and abort deployments",
|
|
1100
|
+
permission_sets_with_scope: [{ ..._northern_tech_utils_constants.defaultPermissionSets.DeployToDevices }]
|
|
1101
|
+
},
|
|
1102
|
+
{
|
|
1103
|
+
name: "RBAC_ROLE_REMOTE_TERMINAL",
|
|
1104
|
+
description: `Intended for tech support accounts, this role can access the devices' Remote Terminal.`,
|
|
1105
|
+
permission_sets_with_scope: [{ ..._northern_tech_utils_constants.defaultPermissionSets.ConnectToDevices }]
|
|
1106
|
+
},
|
|
1107
|
+
{
|
|
1108
|
+
name: "RBAC_ROLE_PERMIT_ALL",
|
|
1109
|
+
description: "",
|
|
1110
|
+
permission_sets_with_scope: [{ ..._northern_tech_utils_constants.defaultPermissionSets.SuperUser }]
|
|
1111
|
+
},
|
|
1112
|
+
{
|
|
1113
|
+
name: "RBAC_ROLE_OBSERVER",
|
|
1114
|
+
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.",
|
|
1115
|
+
permission_sets_with_scope: [{ ..._northern_tech_utils_constants.defaultPermissionSets.ReadReleases }, { ..._northern_tech_utils_constants.defaultPermissionSets.ReadDevices }]
|
|
1116
|
+
},
|
|
1117
|
+
{
|
|
1118
|
+
name: "RBAC_ROLE_CI",
|
|
1119
|
+
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.",
|
|
1120
|
+
permission_sets_with_scope: [
|
|
1121
|
+
{ ..._northern_tech_utils_constants.defaultPermissionSets.ReadReleases },
|
|
1122
|
+
{ ..._northern_tech_utils_constants.defaultPermissionSets.ManageReleases },
|
|
1123
|
+
{ ..._northern_tech_utils_constants.defaultPermissionSets.UploadArtifacts }
|
|
1124
|
+
]
|
|
1125
|
+
},
|
|
1126
|
+
{
|
|
1127
|
+
name: "almostAdmin",
|
|
1128
|
+
description: "almost admin rights",
|
|
1129
|
+
permissions: permissionSets.find((item) => item.name === "almostAdmin")?.permissions
|
|
1130
|
+
},
|
|
1131
|
+
{
|
|
1132
|
+
name: "almostAdminNew",
|
|
1133
|
+
description: "almost admin rights",
|
|
1134
|
+
permission_sets_with_scope: Object.values(_northern_tech_utils_constants.defaultPermissionSets)
|
|
1135
|
+
}
|
|
1136
|
+
];
|
|
1137
|
+
const expectedParsedRoles = {
|
|
1138
|
+
"141sasd": {
|
|
1139
|
+
editable: true,
|
|
1140
|
+
isCustom: void 0,
|
|
1141
|
+
uiPermissions: {
|
|
1142
|
+
..._northern_tech_utils_constants.emptyUiPermissions,
|
|
1143
|
+
groups: { bestgroup: [_northern_tech_utils_constants.uiPermissionsById.read.value, _northern_tech_utils_constants.uiPermissionsById.connect.value] },
|
|
1144
|
+
userManagement: [_northern_tech_utils_constants.uiPermissionsById.manage.value]
|
|
1145
|
+
}
|
|
1146
|
+
},
|
|
1147
|
+
asdasd: {
|
|
1148
|
+
editable: false,
|
|
1149
|
+
isCustom: true,
|
|
1150
|
+
uiPermissions: {
|
|
1151
|
+
..._northern_tech_utils_constants.emptyUiPermissions,
|
|
1152
|
+
userManagement: [_northern_tech_utils_constants.uiPermissionsById.read.value, _northern_tech_utils_constants.uiPermissionsById.manage.value]
|
|
1153
|
+
}
|
|
1154
|
+
},
|
|
1155
|
+
dyn: {
|
|
1156
|
+
editable: false,
|
|
1157
|
+
isCustom: true,
|
|
1158
|
+
uiPermissions: {
|
|
1159
|
+
..._northern_tech_utils_constants.emptyUiPermissions,
|
|
1160
|
+
deployments: [_northern_tech_utils_constants.uiPermissionsById.deploy.value],
|
|
1161
|
+
groups: { dyn: [_northern_tech_utils_constants.uiPermissionsById.read.value, _northern_tech_utils_constants.uiPermissionsById.deploy.value] }
|
|
1162
|
+
}
|
|
1163
|
+
},
|
|
1164
|
+
kljlkk: {
|
|
1165
|
+
editable: true,
|
|
1166
|
+
isCustom: false,
|
|
1167
|
+
uiPermissions: {
|
|
1168
|
+
..._northern_tech_utils_constants.emptyUiPermissions,
|
|
1169
|
+
groups: { bestgroup: [_northern_tech_utils_constants.uiPermissionsById.read.value, _northern_tech_utils_constants.uiPermissionsById.connect.value] }
|
|
1170
|
+
}
|
|
1171
|
+
},
|
|
1172
|
+
yyyyy: {
|
|
1173
|
+
editable: true,
|
|
1174
|
+
isCustom: void 0,
|
|
1175
|
+
uiPermissions: {
|
|
1176
|
+
..._northern_tech_utils_constants.emptyUiPermissions,
|
|
1177
|
+
groups: { dockerclient: [_northern_tech_utils_constants.uiPermissionsById.read.value, _northern_tech_utils_constants.uiPermissionsById.manage.value] },
|
|
1178
|
+
releases: { [_northern_tech_utils_constants.ALL_RELEASES]: [_northern_tech_utils_constants.uiPermissionsById.manage.value] }
|
|
1179
|
+
}
|
|
1180
|
+
},
|
|
1181
|
+
almostAdmin: {
|
|
1182
|
+
editable: false,
|
|
1183
|
+
isCustom: true,
|
|
1184
|
+
uiPermissions: {
|
|
1185
|
+
..._northern_tech_utils_constants.emptyUiPermissions,
|
|
1186
|
+
auditlog: [_northern_tech_utils_constants.uiPermissionsById.read.value],
|
|
1187
|
+
deployments: [
|
|
1188
|
+
_northern_tech_utils_constants.uiPermissionsById.manage.value,
|
|
1189
|
+
_northern_tech_utils_constants.uiPermissionsById.deploy.value,
|
|
1190
|
+
_northern_tech_utils_constants.uiPermissionsById.read.value
|
|
1191
|
+
],
|
|
1192
|
+
groups: { [_northern_tech_utils_constants.ALL_DEVICES]: [
|
|
1193
|
+
_northern_tech_utils_constants.uiPermissionsById.read.value,
|
|
1194
|
+
_northern_tech_utils_constants.uiPermissionsById.manage.value,
|
|
1195
|
+
_northern_tech_utils_constants.uiPermissionsById.connect.value,
|
|
1196
|
+
_northern_tech_utils_constants.uiPermissionsById.configure.value
|
|
1197
|
+
] },
|
|
1198
|
+
releases: { [_northern_tech_utils_constants.ALL_RELEASES]: [
|
|
1199
|
+
_northern_tech_utils_constants.uiPermissionsById.read.value,
|
|
1200
|
+
_northern_tech_utils_constants.uiPermissionsById.upload.value,
|
|
1201
|
+
_northern_tech_utils_constants.uiPermissionsById.manage.value
|
|
1202
|
+
] },
|
|
1203
|
+
userManagement: [_northern_tech_utils_constants.uiPermissionsById.read.value, _northern_tech_utils_constants.uiPermissionsById.manage.value]
|
|
1204
|
+
}
|
|
1205
|
+
},
|
|
1206
|
+
almostAdminNew: {
|
|
1207
|
+
editable: true,
|
|
1208
|
+
isCustom: void 0,
|
|
1209
|
+
uiPermissions: {
|
|
1210
|
+
..._northern_tech_utils_constants.emptyUiPermissions,
|
|
1211
|
+
auditlog: [_northern_tech_utils_constants.uiPermissionsById.read.value],
|
|
1212
|
+
deployments: [
|
|
1213
|
+
_northern_tech_utils_constants.uiPermissionsById.read.value,
|
|
1214
|
+
_northern_tech_utils_constants.uiPermissionsById.deploy.value,
|
|
1215
|
+
_northern_tech_utils_constants.uiPermissionsById.manage.value
|
|
1216
|
+
],
|
|
1217
|
+
groups: { [_northern_tech_utils_constants.ALL_DEVICES]: [
|
|
1218
|
+
_northern_tech_utils_constants.uiPermissionsById.read.value,
|
|
1219
|
+
_northern_tech_utils_constants.uiPermissionsById.manage.value,
|
|
1220
|
+
_northern_tech_utils_constants.uiPermissionsById.deploy.value,
|
|
1221
|
+
_northern_tech_utils_constants.uiPermissionsById.connect.value,
|
|
1222
|
+
_northern_tech_utils_constants.uiPermissionsById.configure.value
|
|
1223
|
+
] },
|
|
1224
|
+
releases: { [_northern_tech_utils_constants.ALL_RELEASES]: [
|
|
1225
|
+
_northern_tech_utils_constants.uiPermissionsById.manage.value,
|
|
1226
|
+
_northern_tech_utils_constants.uiPermissionsById.upload.value,
|
|
1227
|
+
_northern_tech_utils_constants.uiPermissionsById.read.value
|
|
1228
|
+
] },
|
|
1229
|
+
tenantManagement: [_northern_tech_utils_constants.uiPermissionsById.read.value, _northern_tech_utils_constants.uiPermissionsById.manage.value],
|
|
1230
|
+
userManagement: [_northern_tech_utils_constants.uiPermissionsById.read.value, _northern_tech_utils_constants.uiPermissionsById.manage.value]
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
};
|
|
1234
|
+
const defaultRolesById = {
|
|
1235
|
+
..._northern_tech_utils_constants.rolesById,
|
|
1236
|
+
test: {
|
|
1237
|
+
..._northern_tech_utils_constants.emptyRole,
|
|
1238
|
+
name: "test",
|
|
1239
|
+
description: "test description",
|
|
1240
|
+
editable: true,
|
|
1241
|
+
uiPermissions: {
|
|
1242
|
+
..._northern_tech_utils_constants.emptyUiPermissions,
|
|
1243
|
+
groups: { testGroup: [_northern_tech_utils_constants.uiPermissionsById.read.value] },
|
|
1244
|
+
releases: { bar: [_northern_tech_utils_constants.uiPermissionsById.read.value] }
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
};
|
|
1248
|
+
const receivedRoles = rbacRoles.reduce((accu, role) => {
|
|
1249
|
+
const { name, description, ...roleRemainder } = role;
|
|
1250
|
+
if (name.startsWith("RBAC")) accu[name] = {
|
|
1251
|
+
...defaultRolesById[name],
|
|
1252
|
+
...roleRemainder,
|
|
1253
|
+
editable: false,
|
|
1254
|
+
isCustom: false,
|
|
1255
|
+
description: defaultRolesById[name].description ? defaultRolesById[name].description : description
|
|
1256
|
+
};
|
|
1257
|
+
else {
|
|
1258
|
+
const result = expectedParsedRoles[name] ?? {};
|
|
1259
|
+
accu[name] = {
|
|
1260
|
+
..._northern_tech_utils_constants.emptyRole,
|
|
1261
|
+
...role,
|
|
1262
|
+
...result,
|
|
1263
|
+
name
|
|
1264
|
+
};
|
|
1265
|
+
}
|
|
1266
|
+
return accu;
|
|
1267
|
+
}, { ...defaultRolesById });
|
|
1268
|
+
const receivedPermissionSets = permissionSets.reduce((accu, set) => {
|
|
1269
|
+
const result = _northern_tech_utils_constants.defaultPermissionSets[set.name]?.result ?? {};
|
|
1270
|
+
accu[set.name] = {
|
|
1271
|
+
...set,
|
|
1272
|
+
result: {
|
|
1273
|
+
..._northern_tech_utils_constants.emptyUiPermissions,
|
|
1274
|
+
...result
|
|
1275
|
+
}
|
|
1276
|
+
};
|
|
1277
|
+
return accu;
|
|
1278
|
+
}, {});
|
|
1279
|
+
//#endregion
|
|
1280
|
+
exports.TEST_SESSION_DATETIME = TEST_SESSION_DATETIME;
|
|
1281
|
+
exports.accessTokens = accessTokens;
|
|
1282
|
+
exports.adminUserCapabilities = adminUserCapabilities;
|
|
1283
|
+
exports.defaultCreationDate = defaultCreationDate;
|
|
1284
|
+
exports.defaultMacAddress = defaultMacAddress;
|
|
1285
|
+
exports.defaultPassword = defaultPassword;
|
|
1286
|
+
exports.menderEnvironment = menderEnvironment;
|
|
1287
|
+
exports.mockApiResponses = mockApiResponses;
|
|
1288
|
+
exports.mockDate = mockDate;
|
|
1289
|
+
exports.permissionSets = permissionSets;
|
|
1290
|
+
exports.rbacRoles = rbacRoles;
|
|
1291
|
+
exports.receivedPermissionSets = receivedPermissionSets;
|
|
1292
|
+
exports.receivedRoles = receivedRoles;
|
|
1293
|
+
exports.releasesList = releasesList;
|
|
1294
|
+
exports.spTenantLimits = spTenantLimits;
|
|
1295
|
+
exports.tenants = tenants;
|
|
1296
|
+
exports.testSsoId = testSsoId;
|
|
1297
|
+
exports.token = token;
|
|
1298
|
+
exports.undefineds = undefineds;
|
|
1299
|
+
exports.userId = userId;
|
|
1300
|
+
exports.webhookEvents = webhookEvents;
|
|
1301
|
+
|
|
1302
|
+
//# sourceMappingURL=mockData.cjs.map
|