@expcluster/permission-groups 7.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/controller.ts +434 -0
- package/dist/browser/messages.d.ts +527 -0
- package/dist/browser/messages.d.ts.map +1 -0
- package/dist/browser/messages.js +561 -0
- package/dist/browser/messages.js.map +1 -0
- package/dist/browser/package.json +49 -0
- package/dist/browser/tsconfig.browser.tsbuildinfo +1 -0
- package/dist/browser/web/components/AssignmentForm.d.ts +7 -0
- package/dist/browser/web/components/AssignmentForm.d.ts.map +1 -0
- package/dist/browser/web/components/AssignmentForm.js +29 -0
- package/dist/browser/web/components/AssignmentForm.js.map +1 -0
- package/dist/browser/web/components/AssignmentsTable.d.ts +2 -0
- package/dist/browser/web/components/AssignmentsTable.d.ts.map +1 -0
- package/dist/browser/web/components/AssignmentsTable.js +61 -0
- package/dist/browser/web/components/AssignmentsTable.js.map +1 -0
- package/dist/browser/web/components/DeleteConfirm.d.ts +6 -0
- package/dist/browser/web/components/DeleteConfirm.d.ts.map +1 -0
- package/dist/browser/web/components/DeleteConfirm.js +7 -0
- package/dist/browser/web/components/DeleteConfirm.js.map +1 -0
- package/dist/browser/web/components/GroupForm.d.ts +5 -0
- package/dist/browser/web/components/GroupForm.d.ts.map +1 -0
- package/dist/browser/web/components/GroupForm.js +22 -0
- package/dist/browser/web/components/GroupForm.js.map +1 -0
- package/dist/browser/web/components/GroupViewPage.d.ts +2 -0
- package/dist/browser/web/components/GroupViewPage.d.ts.map +1 -0
- package/dist/browser/web/components/GroupViewPage.js +161 -0
- package/dist/browser/web/components/GroupViewPage.js.map +1 -0
- package/dist/browser/web/components/GroupsTable.d.ts +2 -0
- package/dist/browser/web/components/GroupsTable.d.ts.map +1 -0
- package/dist/browser/web/components/GroupsTable.js +29 -0
- package/dist/browser/web/components/GroupsTable.js.map +1 -0
- package/dist/browser/web/components/RoleMappingForm.d.ts +7 -0
- package/dist/browser/web/components/RoleMappingForm.d.ts.map +1 -0
- package/dist/browser/web/components/RoleMappingForm.js +32 -0
- package/dist/browser/web/components/RoleMappingForm.js.map +1 -0
- package/dist/browser/web/components/RoleMappingsTable.d.ts +2 -0
- package/dist/browser/web/components/RoleMappingsTable.d.ts.map +1 -0
- package/dist/browser/web/components/RoleMappingsTable.js +64 -0
- package/dist/browser/web/components/RoleMappingsTable.js.map +1 -0
- package/dist/browser/web/index.d.ts +13 -0
- package/dist/browser/web/index.d.ts.map +1 -0
- package/dist/browser/web/index.js +60 -0
- package/dist/browser/web/index.js.map +1 -0
- package/dist/node/controller.d.ts +37 -0
- package/dist/node/controller.d.ts.map +1 -0
- package/dist/node/controller.js +372 -0
- package/dist/node/controller.js.map +1 -0
- package/dist/node/index.d.ts +10 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +196 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node/instance.d.ts +40 -0
- package/dist/node/instance.d.ts.map +1 -0
- package/dist/node/instance.js +155 -0
- package/dist/node/instance.js.map +1 -0
- package/dist/node/messages.d.ts +527 -0
- package/dist/node/messages.d.ts.map +1 -0
- package/dist/node/messages.js +620 -0
- package/dist/node/messages.js.map +1 -0
- package/dist/node/tsconfig.node.tsbuildinfo +1 -0
- package/dist/web/manifest.json +10 -0
- package/dist/web/static/exp_groups.afefd90b210f7c8e0df2.js +543 -0
- package/dist/web/static/index_ts.f7d30aa0c13ff0be393a.js +22 -0
- package/dist/web/static/main.c2178975889c1c720e80.js +653 -0
- package/dist/web/static/messages_ts.65a81c17fb37953c5d68.js +22 -0
- package/dist/web/static/package_json.aab0d3f37da0567c250c.js +22 -0
- package/dist/web/static/vendors-node_modules_pnpm_ant-design_icons_6_2_3_rea_94b50600dfe79448cabf92d130d83059_node_mo-c79f54.cf768c64b40c811ce6c9.js +273 -0
- package/dist/web/static/vendors-node_modules_pnpm_sinclair_typebox_0_30_4_node_modules_sinclair_typebox_typebox_js.7fa46fac84f2e9324e54.js +22 -0
- package/dist/web/static/web_index_tsx-webpack_sharing_consume_default_react.b4766180f4d467b7b24f.js +102 -0
- package/index.ts +183 -0
- package/instance.ts +171 -0
- package/messages.ts +692 -0
- package/module/control.lua +438 -0
- package/module/globals.lua +11 -0
- package/module/module.json +12 -0
- package/module/module_exports.lua +3 -0
- package/package.json +47 -0
- package/tsconfig.browser.json +4 -0
- package/tsconfig.json +7 -0
- package/tsconfig.node.json +5 -0
- package/web/components/AssignmentForm.tsx +74 -0
- package/web/components/AssignmentsTable.tsx +111 -0
- package/web/components/DeleteConfirm.tsx +16 -0
- package/web/components/GroupForm.tsx +45 -0
- package/web/components/GroupViewPage.tsx +287 -0
- package/web/components/GroupsTable.tsx +49 -0
- package/web/components/RoleMappingForm.tsx +106 -0
- package/web/components/RoleMappingsTable.tsx +107 -0
- package/web/index.tsx +108 -0
- package/webpack.config.js +34 -0
package/messages.ts
ADDED
|
@@ -0,0 +1,692 @@
|
|
|
1
|
+
import * as lib from "@clusterio/lib";
|
|
2
|
+
import { Type, Static } from "@sinclair/typebox";
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
Data records
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export class GroupPermissions {
|
|
9
|
+
constructor(
|
|
10
|
+
public isBlacklist: boolean,
|
|
11
|
+
public permissions: string[],
|
|
12
|
+
) {}
|
|
13
|
+
|
|
14
|
+
static jsonSchema = Type.Object({
|
|
15
|
+
is_blacklist: Type.Boolean(),
|
|
16
|
+
permissions: Type.Array(Type.String()),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
toJSON(): Static<typeof GroupPermissions.jsonSchema> {
|
|
20
|
+
return {
|
|
21
|
+
is_blacklist: this.isBlacklist,
|
|
22
|
+
permissions: this.permissions,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
27
|
+
return new this(
|
|
28
|
+
json.is_blacklist,
|
|
29
|
+
json.permissions,
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export class GroupRecord {
|
|
35
|
+
constructor(
|
|
36
|
+
public id: number,
|
|
37
|
+
public name: string,
|
|
38
|
+
public permissions: GroupPermissions,
|
|
39
|
+
public updatedAtMs: number = 0,
|
|
40
|
+
public isDeleted: boolean = false,
|
|
41
|
+
) {}
|
|
42
|
+
|
|
43
|
+
static jsonSchema = Type.Object({
|
|
44
|
+
id: Type.Integer(),
|
|
45
|
+
name: Type.String(),
|
|
46
|
+
permissions: GroupPermissions.jsonSchema,
|
|
47
|
+
updated_at_ms: Type.Optional(Type.Number()),
|
|
48
|
+
is_deleted: Type.Optional(Type.Boolean()),
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
toJSON() {
|
|
52
|
+
let json: Static<typeof GroupRecord.jsonSchema> = {
|
|
53
|
+
id: this.id,
|
|
54
|
+
name: this.name,
|
|
55
|
+
permissions: this.permissions.toJSON(),
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
if (this.updatedAtMs) {
|
|
59
|
+
json.updated_at_ms = this.updatedAtMs;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (this.isDeleted) {
|
|
63
|
+
json.is_deleted = true;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return json;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
70
|
+
return new this(
|
|
71
|
+
json.id,
|
|
72
|
+
json.name,
|
|
73
|
+
GroupPermissions.fromJSON(json.permissions),
|
|
74
|
+
json.updated_at_ms ?? 0,
|
|
75
|
+
json.is_deleted ?? false,
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export class AssignmentRecord {
|
|
81
|
+
constructor(
|
|
82
|
+
public name: string,
|
|
83
|
+
public groupId: number,
|
|
84
|
+
public updatedAtMs: number = 0,
|
|
85
|
+
public isDeleted: boolean = false,
|
|
86
|
+
) {}
|
|
87
|
+
|
|
88
|
+
get id() {
|
|
89
|
+
return this.name;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
static jsonSchema = Type.Object({
|
|
93
|
+
name: Type.String(),
|
|
94
|
+
group_id: Type.Integer(),
|
|
95
|
+
updated_at_ms: Type.Optional(Type.Number()),
|
|
96
|
+
is_deleted: Type.Optional(Type.Boolean()),
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
toJSON(): Static<typeof AssignmentRecord.jsonSchema> {
|
|
100
|
+
let json: Static<typeof AssignmentRecord.jsonSchema> = {
|
|
101
|
+
name: this.name,
|
|
102
|
+
group_id: this.groupId,
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
if (this.updatedAtMs) {
|
|
106
|
+
json.updated_at_ms = this.updatedAtMs;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (this.isDeleted) {
|
|
110
|
+
json.is_deleted = true;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return json;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
117
|
+
return new this(
|
|
118
|
+
json.name,
|
|
119
|
+
json.group_id,
|
|
120
|
+
json.updated_at_ms ?? 0,
|
|
121
|
+
json.is_deleted ?? false,
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export class RoleMappingRecord {
|
|
127
|
+
constructor(
|
|
128
|
+
public id: number,
|
|
129
|
+
public roleIds: Set<number>,
|
|
130
|
+
public groupId: number,
|
|
131
|
+
public priority: number,
|
|
132
|
+
public enabled: boolean,
|
|
133
|
+
public updatedAtMs: number = 0,
|
|
134
|
+
public isDeleted: boolean = false,
|
|
135
|
+
) {}
|
|
136
|
+
|
|
137
|
+
static jsonSchema = Type.Object({
|
|
138
|
+
id: Type.Integer(),
|
|
139
|
+
role_ids: Type.Array(Type.Integer()),
|
|
140
|
+
group_id: Type.Integer(),
|
|
141
|
+
priority: Type.Number(),
|
|
142
|
+
enabled: Type.Boolean(),
|
|
143
|
+
updated_at_ms: Type.Optional(Type.Number()),
|
|
144
|
+
is_deleted: Type.Optional(Type.Boolean()),
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
toJSON(): Static<typeof RoleMappingRecord.jsonSchema> {
|
|
148
|
+
let json: Static<typeof RoleMappingRecord.jsonSchema> = {
|
|
149
|
+
id: this.id,
|
|
150
|
+
role_ids: [...this.roleIds],
|
|
151
|
+
group_id: this.groupId,
|
|
152
|
+
priority: this.priority,
|
|
153
|
+
enabled: this.enabled,
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
if (this.updatedAtMs) {
|
|
157
|
+
json.updated_at_ms = this.updatedAtMs;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (this.isDeleted) {
|
|
161
|
+
json.is_deleted = true;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return json;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
168
|
+
return new this(
|
|
169
|
+
json.id,
|
|
170
|
+
new Set(json.role_ids),
|
|
171
|
+
json.group_id,
|
|
172
|
+
json.priority,
|
|
173
|
+
json.enabled,
|
|
174
|
+
json.updated_at_ms ?? 0,
|
|
175
|
+
json.is_deleted ?? false,
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/*
|
|
181
|
+
Update events
|
|
182
|
+
*/
|
|
183
|
+
|
|
184
|
+
export class GroupUpdatedEvent {
|
|
185
|
+
declare ["constructor"]: typeof GroupUpdatedEvent;
|
|
186
|
+
static plugin = "exp_groups" as const;
|
|
187
|
+
static type = "event" as const;
|
|
188
|
+
static src = "controller" as const;
|
|
189
|
+
static dst = ["control", "instance"] as const;
|
|
190
|
+
static permission = "exp_groups.group.subscribe" as const;
|
|
191
|
+
|
|
192
|
+
constructor(
|
|
193
|
+
public updates: GroupRecord[],
|
|
194
|
+
) {}
|
|
195
|
+
|
|
196
|
+
static jsonSchema = Type.Object({
|
|
197
|
+
updates: Type.Array(GroupRecord.jsonSchema),
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
toJSON() {
|
|
201
|
+
return { updates: this.updates.map(group => group.toJSON()) };
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
205
|
+
return new this(json.updates.map(group => GroupRecord.fromJSON(group)));
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export class ManualAssignmentUpdatedEvent {
|
|
210
|
+
declare ["constructor"]: typeof ManualAssignmentUpdatedEvent;
|
|
211
|
+
static plugin = "exp_groups" as const;
|
|
212
|
+
static type = "event" as const;
|
|
213
|
+
static src = "controller" as const;
|
|
214
|
+
static dst = ["control", "instance"] as const;
|
|
215
|
+
static permission = "exp_groups.assignment.subscribe" as const;
|
|
216
|
+
|
|
217
|
+
constructor(
|
|
218
|
+
public updates: AssignmentRecord[],
|
|
219
|
+
) {}
|
|
220
|
+
|
|
221
|
+
static jsonSchema = Type.Object({
|
|
222
|
+
updates: Type.Array(AssignmentRecord.jsonSchema),
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
toJSON() {
|
|
226
|
+
return { updates: this.updates.map(assignment => assignment.toJSON()) };
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
230
|
+
return new this(json.updates.map(assignment => AssignmentRecord.fromJSON(assignment)));
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export class ResolvedAssignmentUpdatedEvent {
|
|
235
|
+
declare ["constructor"]: typeof ResolvedAssignmentUpdatedEvent;
|
|
236
|
+
static plugin = "exp_groups" as const;
|
|
237
|
+
static type = "event" as const;
|
|
238
|
+
static src = "controller" as const;
|
|
239
|
+
static dst = ["control", "instance"] as const;
|
|
240
|
+
static permission = "exp_groups.assignment.subscribe" as const;
|
|
241
|
+
|
|
242
|
+
constructor(
|
|
243
|
+
public updates: AssignmentRecord[],
|
|
244
|
+
) {}
|
|
245
|
+
|
|
246
|
+
static jsonSchema = Type.Object({
|
|
247
|
+
updates: Type.Array(AssignmentRecord.jsonSchema),
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
toJSON() {
|
|
251
|
+
return { updates: this.updates.map(assignment => assignment.toJSON()) };
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
255
|
+
return new this(json.updates.map(assignment => AssignmentRecord.fromJSON(assignment)));
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export class RoleMappingUpdatedEvent {
|
|
260
|
+
declare ["constructor"]: typeof RoleMappingUpdatedEvent;
|
|
261
|
+
static plugin = "exp_groups" as const;
|
|
262
|
+
static type = "event" as const;
|
|
263
|
+
static src = "controller" as const;
|
|
264
|
+
static dst = "control" as const;
|
|
265
|
+
static permission = "exp_groups.role_mapping.subscribe" as const;
|
|
266
|
+
|
|
267
|
+
constructor(
|
|
268
|
+
public updates: RoleMappingRecord[],
|
|
269
|
+
) {}
|
|
270
|
+
|
|
271
|
+
static jsonSchema = Type.Object({
|
|
272
|
+
updates: Type.Array(RoleMappingRecord.jsonSchema),
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
toJSON() {
|
|
276
|
+
return { updates: this.updates.map(roleMapping => roleMapping.toJSON()) };
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
280
|
+
return new this(json.updates.map(roleMapping => RoleMappingRecord.fromJSON(roleMapping)));
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/*
|
|
285
|
+
Group requests
|
|
286
|
+
*/
|
|
287
|
+
|
|
288
|
+
export class GroupCreateRequest {
|
|
289
|
+
declare ["constructor"]: typeof GroupCreateRequest;
|
|
290
|
+
static plugin = "exp_groups" as const;
|
|
291
|
+
static type = "request" as const;
|
|
292
|
+
static src = ["control", "instance"] as const;
|
|
293
|
+
static dst = "controller" as const;
|
|
294
|
+
static permission = "exp_groups.group.create" as const;
|
|
295
|
+
static Response = GroupRecord;
|
|
296
|
+
|
|
297
|
+
constructor(
|
|
298
|
+
public name: string,
|
|
299
|
+
public permissions: GroupPermissions,
|
|
300
|
+
) {}
|
|
301
|
+
|
|
302
|
+
static jsonSchema = Type.Object({
|
|
303
|
+
name: Type.String(),
|
|
304
|
+
permissions: GroupPermissions.jsonSchema,
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
toJSON() {
|
|
308
|
+
return {
|
|
309
|
+
name: this.name,
|
|
310
|
+
permissions: this.permissions.toJSON(),
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
315
|
+
return new this(
|
|
316
|
+
json.name,
|
|
317
|
+
GroupPermissions.fromJSON(json.permissions),
|
|
318
|
+
);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
export class GroupUpdateRequest {
|
|
323
|
+
declare ["constructor"]: typeof GroupUpdateRequest;
|
|
324
|
+
static plugin = "exp_groups" as const;
|
|
325
|
+
static type = "request" as const;
|
|
326
|
+
static src = ["control", "instance"] as const;
|
|
327
|
+
static dst = "controller" as const;
|
|
328
|
+
static permission = "exp_groups.group.update" as const;
|
|
329
|
+
|
|
330
|
+
constructor(
|
|
331
|
+
public group: GroupRecord,
|
|
332
|
+
) {}
|
|
333
|
+
|
|
334
|
+
static jsonSchema = Type.Object({
|
|
335
|
+
group: GroupRecord.jsonSchema,
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
toJSON() {
|
|
339
|
+
return {
|
|
340
|
+
group: this.group.toJSON(),
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
345
|
+
return new this(
|
|
346
|
+
GroupRecord.fromJSON(json.group),
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export class GroupDeleteRequest {
|
|
352
|
+
declare ["constructor"]: typeof GroupDeleteRequest;
|
|
353
|
+
static plugin = "exp_groups" as const;
|
|
354
|
+
static type = "request" as const;
|
|
355
|
+
static src = ["control", "instance"] as const;
|
|
356
|
+
static dst = "controller" as const;
|
|
357
|
+
static permission = "exp_groups.group.delete" as const;
|
|
358
|
+
|
|
359
|
+
constructor(
|
|
360
|
+
public groupId: number,
|
|
361
|
+
) {}
|
|
362
|
+
|
|
363
|
+
static jsonSchema = Type.Object({
|
|
364
|
+
group_id: Type.Integer(),
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
toJSON() {
|
|
368
|
+
return {
|
|
369
|
+
group_id: this.groupId,
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
374
|
+
return new this(json.group_id);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
export class GroupGetRequest {
|
|
379
|
+
declare ["constructor"]: typeof GroupGetRequest;
|
|
380
|
+
static plugin = "exp_groups" as const;
|
|
381
|
+
static type = "request" as const;
|
|
382
|
+
static src = ["control", "instance"] as const;
|
|
383
|
+
static dst = "controller" as const;
|
|
384
|
+
static permission = "exp_groups.group.get" as const;
|
|
385
|
+
static Response = GroupRecord;
|
|
386
|
+
|
|
387
|
+
constructor(
|
|
388
|
+
public groupId: number,
|
|
389
|
+
) {}
|
|
390
|
+
|
|
391
|
+
static jsonSchema = Type.Object({
|
|
392
|
+
group_id: Type.Integer(),
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
toJSON() {
|
|
396
|
+
return {
|
|
397
|
+
group_id: this.groupId,
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
402
|
+
return new this(json.group_id);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
export class GroupListRequest {
|
|
407
|
+
declare ["constructor"]: typeof GroupListRequest;
|
|
408
|
+
static plugin = "exp_groups" as const;
|
|
409
|
+
static type = "request" as const;
|
|
410
|
+
static src = ["control", "instance"] as const;
|
|
411
|
+
static dst = "controller" as const;
|
|
412
|
+
static permission = "exp_groups.group.list" as const;
|
|
413
|
+
static Response = lib.jsonArray(GroupRecord);
|
|
414
|
+
|
|
415
|
+
constructor() {}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/*
|
|
419
|
+
Assignment requests
|
|
420
|
+
*/
|
|
421
|
+
|
|
422
|
+
export class AssignmentCreateRequest {
|
|
423
|
+
declare ["constructor"]: typeof AssignmentCreateRequest;
|
|
424
|
+
static plugin = "exp_groups" as const;
|
|
425
|
+
static type = "request" as const;
|
|
426
|
+
static src = ["control", "instance"] as const;
|
|
427
|
+
static dst = "controller" as const;
|
|
428
|
+
static permission = "exp_groups.assignment.create" as const;
|
|
429
|
+
static Response = AssignmentRecord;
|
|
430
|
+
|
|
431
|
+
constructor(
|
|
432
|
+
public name: string,
|
|
433
|
+
public groupId: number,
|
|
434
|
+
) {}
|
|
435
|
+
|
|
436
|
+
static jsonSchema = Type.Object({
|
|
437
|
+
name: Type.String(),
|
|
438
|
+
group_id: Type.Integer(),
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
toJSON() {
|
|
442
|
+
return {
|
|
443
|
+
name: this.name,
|
|
444
|
+
group_id: this.groupId,
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
449
|
+
return new this(json.name, json.group_id);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
export class AssignmentUpdateRequest {
|
|
454
|
+
declare ["constructor"]: typeof AssignmentUpdateRequest;
|
|
455
|
+
static plugin = "exp_groups" as const;
|
|
456
|
+
static type = "request" as const;
|
|
457
|
+
static src = ["control", "instance"] as const;
|
|
458
|
+
static dst = "controller" as const;
|
|
459
|
+
static permission = "exp_groups.assignment.update" as const;
|
|
460
|
+
|
|
461
|
+
constructor(
|
|
462
|
+
public assignment: AssignmentRecord,
|
|
463
|
+
) {}
|
|
464
|
+
|
|
465
|
+
static jsonSchema = Type.Object({
|
|
466
|
+
assignment: AssignmentRecord.jsonSchema,
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
toJSON() {
|
|
470
|
+
return {
|
|
471
|
+
assignment: this.assignment.toJSON(),
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
476
|
+
return new this(
|
|
477
|
+
AssignmentRecord.fromJSON(json.assignment),
|
|
478
|
+
);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
export class AssignmentDeleteRequest {
|
|
483
|
+
declare ["constructor"]: typeof AssignmentDeleteRequest;
|
|
484
|
+
static plugin = "exp_groups" as const;
|
|
485
|
+
static type = "request" as const;
|
|
486
|
+
static src = ["control", "instance"] as const;
|
|
487
|
+
static dst = "controller" as const;
|
|
488
|
+
static permission = "exp_groups.assignment.delete" as const;
|
|
489
|
+
|
|
490
|
+
constructor(
|
|
491
|
+
public name: string,
|
|
492
|
+
) {}
|
|
493
|
+
|
|
494
|
+
static jsonSchema = Type.Object({
|
|
495
|
+
name: Type.String(),
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
toJSON() {
|
|
499
|
+
return {
|
|
500
|
+
name: this.name,
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
505
|
+
return new this(json.name);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
export class AssignmentGetRequest {
|
|
510
|
+
declare ["constructor"]: typeof AssignmentGetRequest;
|
|
511
|
+
static plugin = "exp_groups" as const;
|
|
512
|
+
static type = "request" as const;
|
|
513
|
+
static src = ["control", "instance"] as const;
|
|
514
|
+
static dst = "controller" as const;
|
|
515
|
+
static permission = "exp_groups.assignment.get" as const;
|
|
516
|
+
static Response = AssignmentRecord;
|
|
517
|
+
|
|
518
|
+
constructor(
|
|
519
|
+
public name: string,
|
|
520
|
+
public resolve: boolean = false,
|
|
521
|
+
) {}
|
|
522
|
+
|
|
523
|
+
static jsonSchema = Type.Object({
|
|
524
|
+
name: Type.String(),
|
|
525
|
+
resolve: Type.Boolean(),
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
toJSON() {
|
|
529
|
+
return {
|
|
530
|
+
name: this.name,
|
|
531
|
+
resolve: this.resolve,
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
536
|
+
return new this(json.name, json.resolve);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
export class AssignmentListRequest {
|
|
541
|
+
declare ["constructor"]: typeof AssignmentListRequest;
|
|
542
|
+
static plugin = "exp_groups" as const;
|
|
543
|
+
static type = "request" as const;
|
|
544
|
+
static src = ["control", "instance"] as const;
|
|
545
|
+
static dst = "controller" as const;
|
|
546
|
+
static permission = "exp_groups.assignment.list" as const;
|
|
547
|
+
static Response = lib.jsonArray(AssignmentRecord);
|
|
548
|
+
|
|
549
|
+
constructor() {}
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/*
|
|
553
|
+
Role mapping requests
|
|
554
|
+
*/
|
|
555
|
+
|
|
556
|
+
export class RoleMappingCreateRequest {
|
|
557
|
+
declare ["constructor"]: typeof RoleMappingCreateRequest;
|
|
558
|
+
static plugin = "exp_groups" as const;
|
|
559
|
+
static type = "request" as const;
|
|
560
|
+
static src = ["control", "instance"] as const;
|
|
561
|
+
static dst = "controller" as const;
|
|
562
|
+
static permission = "exp_groups.role_mapping.create" as const;
|
|
563
|
+
static Response = RoleMappingRecord;
|
|
564
|
+
|
|
565
|
+
constructor(
|
|
566
|
+
public roleIds: number[],
|
|
567
|
+
public groupId: number,
|
|
568
|
+
public priority: number,
|
|
569
|
+
public enabled: boolean,
|
|
570
|
+
) {}
|
|
571
|
+
|
|
572
|
+
static jsonSchema = Type.Object({
|
|
573
|
+
role_ids: Type.Array(Type.Integer()),
|
|
574
|
+
group_id: Type.Integer(),
|
|
575
|
+
priority: Type.Number(),
|
|
576
|
+
enabled: Type.Boolean(),
|
|
577
|
+
});
|
|
578
|
+
|
|
579
|
+
toJSON() {
|
|
580
|
+
return {
|
|
581
|
+
role_ids: this.roleIds,
|
|
582
|
+
group_id: this.groupId,
|
|
583
|
+
priority: this.priority,
|
|
584
|
+
enabled: this.enabled,
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
589
|
+
return new this(
|
|
590
|
+
json.role_ids,
|
|
591
|
+
json.group_id,
|
|
592
|
+
json.priority,
|
|
593
|
+
json.enabled,
|
|
594
|
+
);
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
export class RoleMappingUpdateRequest {
|
|
599
|
+
declare ["constructor"]: typeof RoleMappingUpdateRequest;
|
|
600
|
+
static plugin = "exp_groups" as const;
|
|
601
|
+
static type = "request" as const;
|
|
602
|
+
static src = ["control", "instance"] as const;
|
|
603
|
+
static dst = "controller" as const;
|
|
604
|
+
static permission = "exp_groups.role_mapping.update" as const;
|
|
605
|
+
|
|
606
|
+
constructor(
|
|
607
|
+
public roleMapping: RoleMappingRecord,
|
|
608
|
+
) {}
|
|
609
|
+
|
|
610
|
+
static jsonSchema = Type.Object({
|
|
611
|
+
role_mapping: RoleMappingRecord.jsonSchema,
|
|
612
|
+
});
|
|
613
|
+
|
|
614
|
+
toJSON() {
|
|
615
|
+
return {
|
|
616
|
+
role_mapping: this.roleMapping.toJSON(),
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
621
|
+
return new this(
|
|
622
|
+
RoleMappingRecord.fromJSON(json.role_mapping),
|
|
623
|
+
);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
export class RoleMappingDeleteRequest {
|
|
628
|
+
declare ["constructor"]: typeof RoleMappingDeleteRequest;
|
|
629
|
+
static plugin = "exp_groups" as const;
|
|
630
|
+
static type = "request" as const;
|
|
631
|
+
static src = ["control", "instance"] as const;
|
|
632
|
+
static dst = "controller" as const;
|
|
633
|
+
static permission = "exp_groups.role_mapping.delete" as const;
|
|
634
|
+
|
|
635
|
+
constructor(
|
|
636
|
+
public id: number,
|
|
637
|
+
) {}
|
|
638
|
+
|
|
639
|
+
static jsonSchema = Type.Object({
|
|
640
|
+
id: Type.Integer(),
|
|
641
|
+
});
|
|
642
|
+
|
|
643
|
+
toJSON() {
|
|
644
|
+
return {
|
|
645
|
+
id: this.id,
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
650
|
+
return new this(json.id);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
export class RoleMappingGetRequest {
|
|
655
|
+
declare ["constructor"]: typeof RoleMappingGetRequest;
|
|
656
|
+
static plugin = "exp_groups" as const;
|
|
657
|
+
static type = "request" as const;
|
|
658
|
+
static src = ["control", "instance"] as const;
|
|
659
|
+
static dst = "controller" as const;
|
|
660
|
+
static permission = "exp_groups.role_mapping.get" as const;
|
|
661
|
+
static Response = RoleMappingRecord;
|
|
662
|
+
|
|
663
|
+
constructor(
|
|
664
|
+
public id: number,
|
|
665
|
+
) {}
|
|
666
|
+
|
|
667
|
+
static jsonSchema = Type.Object({
|
|
668
|
+
id: Type.Integer(),
|
|
669
|
+
});
|
|
670
|
+
|
|
671
|
+
toJSON() {
|
|
672
|
+
return {
|
|
673
|
+
id: this.id,
|
|
674
|
+
};
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
|
678
|
+
return new this(json.id);
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
export class RoleMappingListRequest {
|
|
683
|
+
declare ["constructor"]: typeof RoleMappingListRequest;
|
|
684
|
+
static plugin = "exp_groups" as const;
|
|
685
|
+
static type = "request" as const;
|
|
686
|
+
static src = ["control", "instance"] as const;
|
|
687
|
+
static dst = "controller" as const;
|
|
688
|
+
static permission = "exp_groups.role_mapping.list" as const;
|
|
689
|
+
static Response = lib.jsonArray(RoleMappingRecord);
|
|
690
|
+
|
|
691
|
+
constructor() {}
|
|
692
|
+
}
|