-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsys-role-permission-set.object.ts
More file actions
74 lines (65 loc) · 1.98 KB
/
Copy pathsys-role-permission-set.object.ts
File metadata and controls
74 lines (65 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
import { ObjectSchema, Field } from '@objectstack/spec/data';
/**
* sys_role_permission_set — Role ↔ PermissionSet binding.
*
* Allows administrators to compose a `sys_role` from one or more
* `sys_permission_set` rows. At request time, the runtime resolver
* (`resolveExecutionContext`) collects every permission set bound to
* the user's roles via this table and injects their names into
* `ExecutionContext.permissions[]` for downstream RBAC evaluation.
*
* @namespace sys
*/
export const SysRolePermissionSet = ObjectSchema.create({
name: 'sys_role_permission_set',
label: 'Role Permission Set',
pluralLabel: 'Role Permission Sets',
icon: 'shield-plus',
isSystem: true,
managedBy: 'system',
description: 'Binds a permission set to a role.',
titleFormat: '{role_id} → {permission_set_id}',
highlightFields: ['role_id', 'permission_set_id'],
fields: {
id: Field.text({
label: 'Binding ID',
required: true,
readonly: true,
description: 'UUID of the role-permission-set binding.',
}),
role_id: Field.lookup('sys_role', {
label: 'Role',
required: true,
description: 'Foreign key to sys_role.',
}),
permission_set_id: Field.lookup('sys_permission_set', {
label: 'Permission Set',
required: true,
description: 'Foreign key to sys_permission_set.',
}),
created_at: Field.datetime({
label: 'Created At',
defaultValue: 'NOW()',
readonly: true,
}),
updated_at: Field.datetime({
label: 'Updated At',
defaultValue: 'NOW()',
readonly: true,
}),
},
indexes: [
{ fields: ['role_id', 'permission_set_id'], unique: true },
{ fields: ['role_id'] },
{ fields: ['permission_set_id'] },
],
enable: {
trackHistory: true,
searchable: true,
apiEnabled: true,
apiMethods: ['get', 'list', 'create', 'update', 'delete'],
trash: true,
mru: false,
},
});