pulse-hub 3.5.0 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/backend/.env.example +52 -52
- package/backend/agent.js +372 -372
- package/backend/cli.js +23 -1
- package/backend/emails/env-backup.html +52 -52
- package/backend/emails/invite.html +53 -53
- package/backend/lib/agent-rpc.js +72 -72
- package/backend/lib/async-route.js +17 -17
- package/backend/lib/authz/bootstrap.js +35 -35
- package/backend/lib/authz/catalog.js +291 -291
- package/backend/lib/authz/delegation.js +104 -104
- package/backend/lib/authz/effective.js +104 -104
- package/backend/lib/authz/engine.js +251 -251
- package/backend/lib/authz/index.js +134 -134
- package/backend/lib/authz/migrate.js +871 -871
- package/backend/lib/authz/mutate.js +87 -87
- package/backend/lib/authz/preview.js +327 -327
- package/backend/lib/authz/scope.js +282 -282
- package/backend/lib/env-mask.js +131 -131
- package/backend/lib/invite-helpers.js +83 -83
- package/backend/lib/invites.js +160 -160
- package/backend/lib/logs.js +244 -244
- package/backend/lib/metrics.js +249 -249
- package/backend/lib/relay-state.js +564 -564
- package/backend/lib/session.js +48 -48
- package/backend/middleware/authz.js +65 -65
- package/backend/public/assets/favicon.svg +6 -6
- package/backend/public/assets/index.js +1 -1
- package/backend/public/index.html +23 -24
- package/backend/routes/access.js +123 -123
- package/backend/routes/audit.js +41 -41
- package/backend/routes/auth.js +207 -207
- package/backend/routes/invites-public.js +91 -91
- package/backend/routes/invites.js +121 -121
- package/backend/routes/logs.js +68 -68
- package/backend/routes/metrics.js +76 -76
- package/backend/routes/policies.js +240 -240
- package/backend/routes/teams.js +221 -221
- package/backend/routes/users.js +100 -100
- package/backend/seed-admins.js +68 -68
- package/backend/server.js +106 -106
- package/backend/ws/agent-relay.js +159 -159
- package/package.json +1 -1
|
@@ -1,291 +1,291 @@
|
|
|
1
|
-
// Permission catalog — single source of truth for all actions
|
|
2
|
-
const ACTIONS = [
|
|
3
|
-
// Servers
|
|
4
|
-
{
|
|
5
|
-
id: 'servers.view',
|
|
6
|
-
feature: 'Servers',
|
|
7
|
-
label: 'View servers',
|
|
8
|
-
description: 'View server information',
|
|
9
|
-
powerful: false,
|
|
10
|
-
scopeKind: 'server',
|
|
11
|
-
implies: [],
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
id: 'servers.create',
|
|
15
|
-
feature: 'Servers',
|
|
16
|
-
label: 'Register servers',
|
|
17
|
-
description: 'Register a new server',
|
|
18
|
-
powerful: true,
|
|
19
|
-
scopeKind: 'server',
|
|
20
|
-
implies: [],
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
id: 'servers.delete',
|
|
24
|
-
feature: 'Servers',
|
|
25
|
-
label: 'Delete servers',
|
|
26
|
-
description: 'Remove a registered server',
|
|
27
|
-
powerful: true,
|
|
28
|
-
scopeKind: 'server',
|
|
29
|
-
implies: [],
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
id: 'servers.update',
|
|
33
|
-
feature: 'Servers',
|
|
34
|
-
label: 'Update servers',
|
|
35
|
-
description: 'Modify server configuration and metadata',
|
|
36
|
-
powerful: true,
|
|
37
|
-
scopeKind: 'server',
|
|
38
|
-
implies: [],
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
id: 'servers.tags.manage',
|
|
42
|
-
feature: 'Servers',
|
|
43
|
-
label: 'Manage access tags',
|
|
44
|
-
description: 'Modify server access tags',
|
|
45
|
-
powerful: true,
|
|
46
|
-
scopeKind: 'server',
|
|
47
|
-
implies: [],
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
id: 'servers.agent.update',
|
|
51
|
-
feature: 'Servers',
|
|
52
|
-
label: 'Update agent',
|
|
53
|
-
description: 'Update or restart the server agent',
|
|
54
|
-
powerful: true,
|
|
55
|
-
scopeKind: 'server',
|
|
56
|
-
implies: [],
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
// Metrics
|
|
60
|
-
{
|
|
61
|
-
id: 'metrics.view',
|
|
62
|
-
feature: 'Metrics',
|
|
63
|
-
label: 'View metrics',
|
|
64
|
-
description: 'View server metrics and resource usage',
|
|
65
|
-
powerful: false,
|
|
66
|
-
scopeKind: 'service',
|
|
67
|
-
implies: [],
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
// Logs
|
|
71
|
-
{
|
|
72
|
-
id: 'logs.view',
|
|
73
|
-
feature: 'Logs',
|
|
74
|
-
label: 'View logs',
|
|
75
|
-
description: 'View service and server logs',
|
|
76
|
-
powerful: false,
|
|
77
|
-
scopeKind: 'service',
|
|
78
|
-
implies: [],
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
// Environment files
|
|
82
|
-
{
|
|
83
|
-
id: 'env.view',
|
|
84
|
-
feature: 'Environment files',
|
|
85
|
-
label: 'View env files',
|
|
86
|
-
description: 'View env files with sensitive values masked',
|
|
87
|
-
powerful: false,
|
|
88
|
-
scopeKind: 'envfile',
|
|
89
|
-
implies: [],
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
id: 'env.reveal',
|
|
93
|
-
feature: 'Environment files',
|
|
94
|
-
label: 'Reveal env values',
|
|
95
|
-
description: 'Reveal plaintext env values',
|
|
96
|
-
powerful: true,
|
|
97
|
-
scopeKind: 'envfile',
|
|
98
|
-
implies: [],
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
id: 'env.edit',
|
|
102
|
-
feature: 'Environment files',
|
|
103
|
-
label: 'Edit env files',
|
|
104
|
-
description: 'Modify env variables',
|
|
105
|
-
powerful: true,
|
|
106
|
-
scopeKind: 'envfile',
|
|
107
|
-
implies: ['env.view'],
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
id: 'env.setup',
|
|
111
|
-
feature: 'Environment files',
|
|
112
|
-
label: 'Register env files',
|
|
113
|
-
description: 'Register or remove env-file entries',
|
|
114
|
-
powerful: true,
|
|
115
|
-
scopeKind: 'envfile',
|
|
116
|
-
implies: [],
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
id: 'env.restore',
|
|
120
|
-
feature: 'Environment files',
|
|
121
|
-
label: 'Restore env files',
|
|
122
|
-
description: 'Restore a previous env-file configuration',
|
|
123
|
-
powerful: true,
|
|
124
|
-
scopeKind: 'envfile',
|
|
125
|
-
implies: ['env.view'],
|
|
126
|
-
},
|
|
127
|
-
|
|
128
|
-
// Services
|
|
129
|
-
{
|
|
130
|
-
id: 'service.restart',
|
|
131
|
-
feature: 'Services',
|
|
132
|
-
label: 'Restart services',
|
|
133
|
-
description: 'Restart an authorized service',
|
|
134
|
-
powerful: true,
|
|
135
|
-
scopeKind: 'service',
|
|
136
|
-
implies: [],
|
|
137
|
-
},
|
|
138
|
-
|
|
139
|
-
// People
|
|
140
|
-
{
|
|
141
|
-
id: 'people.view',
|
|
142
|
-
feature: 'People',
|
|
143
|
-
label: 'View people',
|
|
144
|
-
description: 'View people and their team memberships',
|
|
145
|
-
powerful: false,
|
|
146
|
-
scopeKind: 'org',
|
|
147
|
-
implies: [],
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
id: 'people.invite',
|
|
151
|
-
feature: 'People',
|
|
152
|
-
label: 'Invite people',
|
|
153
|
-
description: 'Invite new users',
|
|
154
|
-
powerful: true,
|
|
155
|
-
scopeKind: 'org',
|
|
156
|
-
implies: [],
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
id: 'people.remove',
|
|
160
|
-
feature: 'People',
|
|
161
|
-
label: 'Remove people',
|
|
162
|
-
description: 'Remove users from the system',
|
|
163
|
-
powerful: true,
|
|
164
|
-
scopeKind: 'org',
|
|
165
|
-
implies: [],
|
|
166
|
-
},
|
|
167
|
-
|
|
168
|
-
// Teams
|
|
169
|
-
{
|
|
170
|
-
id: 'teams.view',
|
|
171
|
-
feature: 'Teams',
|
|
172
|
-
label: 'View teams',
|
|
173
|
-
description: 'View team structure',
|
|
174
|
-
powerful: false,
|
|
175
|
-
scopeKind: 'org',
|
|
176
|
-
implies: [],
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
id: 'teams.create',
|
|
180
|
-
feature: 'Teams',
|
|
181
|
-
label: 'Create teams',
|
|
182
|
-
description: 'Create a new team',
|
|
183
|
-
powerful: true,
|
|
184
|
-
scopeKind: 'org',
|
|
185
|
-
implies: [],
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
id: 'teams.update',
|
|
189
|
-
feature: 'Teams',
|
|
190
|
-
label: 'Update teams',
|
|
191
|
-
description: 'Modify team properties',
|
|
192
|
-
powerful: true,
|
|
193
|
-
scopeKind: 'org',
|
|
194
|
-
implies: [],
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
id: 'teams.delete',
|
|
198
|
-
feature: 'Teams',
|
|
199
|
-
label: 'Delete teams',
|
|
200
|
-
description: 'Delete a team',
|
|
201
|
-
powerful: true,
|
|
202
|
-
scopeKind: 'org',
|
|
203
|
-
implies: [],
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
id: 'teams.members.manage',
|
|
207
|
-
feature: 'Teams',
|
|
208
|
-
label: 'Manage team members',
|
|
209
|
-
description: 'Add or remove team members',
|
|
210
|
-
powerful: true,
|
|
211
|
-
scopeKind: 'org',
|
|
212
|
-
implies: [],
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
id: 'teams.policies.manage',
|
|
216
|
-
feature: 'Teams',
|
|
217
|
-
label: 'Manage team policies',
|
|
218
|
-
description: 'Attach or detach policies from a team',
|
|
219
|
-
powerful: true,
|
|
220
|
-
scopeKind: 'org',
|
|
221
|
-
implies: [],
|
|
222
|
-
},
|
|
223
|
-
|
|
224
|
-
// Policies
|
|
225
|
-
{
|
|
226
|
-
id: 'policies.view',
|
|
227
|
-
feature: 'Policies',
|
|
228
|
-
label: 'View policies',
|
|
229
|
-
description: 'View available policies',
|
|
230
|
-
powerful: false,
|
|
231
|
-
scopeKind: 'org',
|
|
232
|
-
implies: [],
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
id: 'policies.create',
|
|
236
|
-
feature: 'Policies',
|
|
237
|
-
label: 'Create policies',
|
|
238
|
-
description: 'Create a new policy',
|
|
239
|
-
powerful: true,
|
|
240
|
-
scopeKind: 'org',
|
|
241
|
-
implies: [],
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
id: 'policies.update',
|
|
245
|
-
feature: 'Policies',
|
|
246
|
-
label: 'Update policies',
|
|
247
|
-
description: 'Modify a policy',
|
|
248
|
-
powerful: true,
|
|
249
|
-
scopeKind: 'org',
|
|
250
|
-
implies: [],
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
id: 'policies.delete',
|
|
254
|
-
feature: 'Policies',
|
|
255
|
-
label: 'Delete policies',
|
|
256
|
-
description: 'Delete a policy',
|
|
257
|
-
powerful: true,
|
|
258
|
-
scopeKind: 'org',
|
|
259
|
-
implies: [],
|
|
260
|
-
},
|
|
261
|
-
|
|
262
|
-
// Audit
|
|
263
|
-
{
|
|
264
|
-
id: 'audit.view',
|
|
265
|
-
feature: 'Audit',
|
|
266
|
-
label: 'View audit log',
|
|
267
|
-
description: 'View the audit log',
|
|
268
|
-
powerful: false,
|
|
269
|
-
scopeKind: 'org',
|
|
270
|
-
implies: [],
|
|
271
|
-
},
|
|
272
|
-
];
|
|
273
|
-
|
|
274
|
-
// Validate that all implied actions exist
|
|
275
|
-
const actionIds = new Set(ACTIONS.map((a) => a.id));
|
|
276
|
-
for (const action of ACTIONS) {
|
|
277
|
-
for (const implied of action.implies) {
|
|
278
|
-
if (!actionIds.has(implied)) {
|
|
279
|
-
throw new Error(`Action ${action.id} implies non-existent action ${implied}`);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
function getAction(id) {
|
|
285
|
-
return ACTIONS.find((a) => a.id === id);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
module.exports = {
|
|
289
|
-
ACTIONS,
|
|
290
|
-
getAction,
|
|
291
|
-
};
|
|
1
|
+
// Permission catalog — single source of truth for all actions
|
|
2
|
+
const ACTIONS = [
|
|
3
|
+
// Servers
|
|
4
|
+
{
|
|
5
|
+
id: 'servers.view',
|
|
6
|
+
feature: 'Servers',
|
|
7
|
+
label: 'View servers',
|
|
8
|
+
description: 'View server information',
|
|
9
|
+
powerful: false,
|
|
10
|
+
scopeKind: 'server',
|
|
11
|
+
implies: [],
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
id: 'servers.create',
|
|
15
|
+
feature: 'Servers',
|
|
16
|
+
label: 'Register servers',
|
|
17
|
+
description: 'Register a new server',
|
|
18
|
+
powerful: true,
|
|
19
|
+
scopeKind: 'server',
|
|
20
|
+
implies: [],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: 'servers.delete',
|
|
24
|
+
feature: 'Servers',
|
|
25
|
+
label: 'Delete servers',
|
|
26
|
+
description: 'Remove a registered server',
|
|
27
|
+
powerful: true,
|
|
28
|
+
scopeKind: 'server',
|
|
29
|
+
implies: [],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: 'servers.update',
|
|
33
|
+
feature: 'Servers',
|
|
34
|
+
label: 'Update servers',
|
|
35
|
+
description: 'Modify server configuration and metadata',
|
|
36
|
+
powerful: true,
|
|
37
|
+
scopeKind: 'server',
|
|
38
|
+
implies: [],
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 'servers.tags.manage',
|
|
42
|
+
feature: 'Servers',
|
|
43
|
+
label: 'Manage access tags',
|
|
44
|
+
description: 'Modify server access tags',
|
|
45
|
+
powerful: true,
|
|
46
|
+
scopeKind: 'server',
|
|
47
|
+
implies: [],
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: 'servers.agent.update',
|
|
51
|
+
feature: 'Servers',
|
|
52
|
+
label: 'Update agent',
|
|
53
|
+
description: 'Update or restart the server agent',
|
|
54
|
+
powerful: true,
|
|
55
|
+
scopeKind: 'server',
|
|
56
|
+
implies: [],
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
// Metrics
|
|
60
|
+
{
|
|
61
|
+
id: 'metrics.view',
|
|
62
|
+
feature: 'Metrics',
|
|
63
|
+
label: 'View metrics',
|
|
64
|
+
description: 'View server metrics and resource usage',
|
|
65
|
+
powerful: false,
|
|
66
|
+
scopeKind: 'service',
|
|
67
|
+
implies: [],
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
// Logs
|
|
71
|
+
{
|
|
72
|
+
id: 'logs.view',
|
|
73
|
+
feature: 'Logs',
|
|
74
|
+
label: 'View logs',
|
|
75
|
+
description: 'View service and server logs',
|
|
76
|
+
powerful: false,
|
|
77
|
+
scopeKind: 'service',
|
|
78
|
+
implies: [],
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
// Environment files
|
|
82
|
+
{
|
|
83
|
+
id: 'env.view',
|
|
84
|
+
feature: 'Environment files',
|
|
85
|
+
label: 'View env files',
|
|
86
|
+
description: 'View env files with sensitive values masked',
|
|
87
|
+
powerful: false,
|
|
88
|
+
scopeKind: 'envfile',
|
|
89
|
+
implies: [],
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: 'env.reveal',
|
|
93
|
+
feature: 'Environment files',
|
|
94
|
+
label: 'Reveal env values',
|
|
95
|
+
description: 'Reveal plaintext env values',
|
|
96
|
+
powerful: true,
|
|
97
|
+
scopeKind: 'envfile',
|
|
98
|
+
implies: [],
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: 'env.edit',
|
|
102
|
+
feature: 'Environment files',
|
|
103
|
+
label: 'Edit env files',
|
|
104
|
+
description: 'Modify env variables',
|
|
105
|
+
powerful: true,
|
|
106
|
+
scopeKind: 'envfile',
|
|
107
|
+
implies: ['env.view'],
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: 'env.setup',
|
|
111
|
+
feature: 'Environment files',
|
|
112
|
+
label: 'Register env files',
|
|
113
|
+
description: 'Register or remove env-file entries',
|
|
114
|
+
powerful: true,
|
|
115
|
+
scopeKind: 'envfile',
|
|
116
|
+
implies: [],
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
id: 'env.restore',
|
|
120
|
+
feature: 'Environment files',
|
|
121
|
+
label: 'Restore env files',
|
|
122
|
+
description: 'Restore a previous env-file configuration',
|
|
123
|
+
powerful: true,
|
|
124
|
+
scopeKind: 'envfile',
|
|
125
|
+
implies: ['env.view'],
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
// Services
|
|
129
|
+
{
|
|
130
|
+
id: 'service.restart',
|
|
131
|
+
feature: 'Services',
|
|
132
|
+
label: 'Restart services',
|
|
133
|
+
description: 'Restart an authorized service',
|
|
134
|
+
powerful: true,
|
|
135
|
+
scopeKind: 'service',
|
|
136
|
+
implies: [],
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
// People
|
|
140
|
+
{
|
|
141
|
+
id: 'people.view',
|
|
142
|
+
feature: 'People',
|
|
143
|
+
label: 'View people',
|
|
144
|
+
description: 'View people and their team memberships',
|
|
145
|
+
powerful: false,
|
|
146
|
+
scopeKind: 'org',
|
|
147
|
+
implies: [],
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
id: 'people.invite',
|
|
151
|
+
feature: 'People',
|
|
152
|
+
label: 'Invite people',
|
|
153
|
+
description: 'Invite new users',
|
|
154
|
+
powerful: true,
|
|
155
|
+
scopeKind: 'org',
|
|
156
|
+
implies: [],
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
id: 'people.remove',
|
|
160
|
+
feature: 'People',
|
|
161
|
+
label: 'Remove people',
|
|
162
|
+
description: 'Remove users from the system',
|
|
163
|
+
powerful: true,
|
|
164
|
+
scopeKind: 'org',
|
|
165
|
+
implies: [],
|
|
166
|
+
},
|
|
167
|
+
|
|
168
|
+
// Teams
|
|
169
|
+
{
|
|
170
|
+
id: 'teams.view',
|
|
171
|
+
feature: 'Teams',
|
|
172
|
+
label: 'View teams',
|
|
173
|
+
description: 'View team structure',
|
|
174
|
+
powerful: false,
|
|
175
|
+
scopeKind: 'org',
|
|
176
|
+
implies: [],
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
id: 'teams.create',
|
|
180
|
+
feature: 'Teams',
|
|
181
|
+
label: 'Create teams',
|
|
182
|
+
description: 'Create a new team',
|
|
183
|
+
powerful: true,
|
|
184
|
+
scopeKind: 'org',
|
|
185
|
+
implies: [],
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
id: 'teams.update',
|
|
189
|
+
feature: 'Teams',
|
|
190
|
+
label: 'Update teams',
|
|
191
|
+
description: 'Modify team properties',
|
|
192
|
+
powerful: true,
|
|
193
|
+
scopeKind: 'org',
|
|
194
|
+
implies: [],
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
id: 'teams.delete',
|
|
198
|
+
feature: 'Teams',
|
|
199
|
+
label: 'Delete teams',
|
|
200
|
+
description: 'Delete a team',
|
|
201
|
+
powerful: true,
|
|
202
|
+
scopeKind: 'org',
|
|
203
|
+
implies: [],
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
id: 'teams.members.manage',
|
|
207
|
+
feature: 'Teams',
|
|
208
|
+
label: 'Manage team members',
|
|
209
|
+
description: 'Add or remove team members',
|
|
210
|
+
powerful: true,
|
|
211
|
+
scopeKind: 'org',
|
|
212
|
+
implies: [],
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
id: 'teams.policies.manage',
|
|
216
|
+
feature: 'Teams',
|
|
217
|
+
label: 'Manage team policies',
|
|
218
|
+
description: 'Attach or detach policies from a team',
|
|
219
|
+
powerful: true,
|
|
220
|
+
scopeKind: 'org',
|
|
221
|
+
implies: [],
|
|
222
|
+
},
|
|
223
|
+
|
|
224
|
+
// Policies
|
|
225
|
+
{
|
|
226
|
+
id: 'policies.view',
|
|
227
|
+
feature: 'Policies',
|
|
228
|
+
label: 'View policies',
|
|
229
|
+
description: 'View available policies',
|
|
230
|
+
powerful: false,
|
|
231
|
+
scopeKind: 'org',
|
|
232
|
+
implies: [],
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
id: 'policies.create',
|
|
236
|
+
feature: 'Policies',
|
|
237
|
+
label: 'Create policies',
|
|
238
|
+
description: 'Create a new policy',
|
|
239
|
+
powerful: true,
|
|
240
|
+
scopeKind: 'org',
|
|
241
|
+
implies: [],
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
id: 'policies.update',
|
|
245
|
+
feature: 'Policies',
|
|
246
|
+
label: 'Update policies',
|
|
247
|
+
description: 'Modify a policy',
|
|
248
|
+
powerful: true,
|
|
249
|
+
scopeKind: 'org',
|
|
250
|
+
implies: [],
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
id: 'policies.delete',
|
|
254
|
+
feature: 'Policies',
|
|
255
|
+
label: 'Delete policies',
|
|
256
|
+
description: 'Delete a policy',
|
|
257
|
+
powerful: true,
|
|
258
|
+
scopeKind: 'org',
|
|
259
|
+
implies: [],
|
|
260
|
+
},
|
|
261
|
+
|
|
262
|
+
// Audit
|
|
263
|
+
{
|
|
264
|
+
id: 'audit.view',
|
|
265
|
+
feature: 'Audit',
|
|
266
|
+
label: 'View audit log',
|
|
267
|
+
description: 'View the audit log',
|
|
268
|
+
powerful: false,
|
|
269
|
+
scopeKind: 'org',
|
|
270
|
+
implies: [],
|
|
271
|
+
},
|
|
272
|
+
];
|
|
273
|
+
|
|
274
|
+
// Validate that all implied actions exist
|
|
275
|
+
const actionIds = new Set(ACTIONS.map((a) => a.id));
|
|
276
|
+
for (const action of ACTIONS) {
|
|
277
|
+
for (const implied of action.implies) {
|
|
278
|
+
if (!actionIds.has(implied)) {
|
|
279
|
+
throw new Error(`Action ${action.id} implies non-existent action ${implied}`);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
function getAction(id) {
|
|
285
|
+
return ACTIONS.find((a) => a.id === id);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
module.exports = {
|
|
289
|
+
ACTIONS,
|
|
290
|
+
getAction,
|
|
291
|
+
};
|