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