@headless-lms/core 0.4.0 → 0.5.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/dist/assets/events.d.ts +27 -21
- package/dist/assets/file-urls.d.ts +11 -7
- package/dist/assets/file-urls.js +14 -4
- package/dist/assets/file-urls.js.map +1 -1
- package/dist/assets/index.d.ts +4 -4
- package/dist/assets/index.js +3 -3
- package/dist/assets/ports.d.ts +34 -15
- package/dist/assets/service.d.ts +30 -14
- package/dist/assets/service.js +230 -56
- package/dist/assets/service.js.map +1 -1
- package/dist/automations/actions.js.map +1 -1
- package/dist/automations/catalog.js +69 -4
- package/dist/automations/catalog.js.map +1 -1
- package/dist/automations/community-derivations.js +16 -16
- package/dist/automations/community-derivations.js.map +1 -1
- package/dist/automations/community-mail.d.ts +34 -4
- package/dist/automations/community-mail.js +32 -4
- package/dist/automations/community-mail.js.map +1 -1
- package/dist/automations/event-permissions.d.ts +12 -0
- package/dist/automations/event-permissions.js +38 -0
- package/dist/automations/event-permissions.js.map +1 -0
- package/dist/automations/index.d.ts +2 -1
- package/dist/automations/index.js +2 -1
- package/dist/automations/notifications/applicable.d.ts +8 -0
- package/dist/automations/notifications/applicable.js +12 -0
- package/dist/automations/notifications/applicable.js.map +1 -0
- package/dist/automations/notifications/debounce.js +1 -1
- package/dist/automations/notifications/debounce.js.map +1 -1
- package/dist/automations/notifications/defaults.js +33 -3
- package/dist/automations/notifications/defaults.js.map +1 -1
- package/dist/automations/notifications/processor.js +3 -3
- package/dist/automations/notifications/processor.js.map +1 -1
- package/dist/automations/notifications/rules/content.js +60 -3
- package/dist/automations/notifications/rules/content.js.map +1 -1
- package/dist/automations/notifications/rules/discussion.js +29 -29
- package/dist/automations/notifications/rules/discussion.js.map +1 -1
- package/dist/automations/notifications/rules/entitlements.js +36 -9
- package/dist/automations/notifications/rules/entitlements.js.map +1 -1
- package/dist/automations/notifications/rules/events.d.ts +9 -0
- package/dist/automations/notifications/rules/events.js +27 -0
- package/dist/automations/notifications/rules/events.js.map +1 -0
- package/dist/automations/notifications/rules/organizations.js +17 -10
- package/dist/automations/notifications/rules/organizations.js.map +1 -1
- package/dist/automations/notifications/rules/recipients.js +0 -1
- package/dist/automations/notifications/rules/recipients.js.map +1 -1
- package/dist/automations/notifications/service.d.ts +8 -6
- package/dist/automations/notifications/service.js +13 -13
- package/dist/automations/notifications/service.js.map +1 -1
- package/dist/automations/notifications/types.js +94 -7
- package/dist/automations/notifications/types.js.map +1 -1
- package/dist/automations/ports.d.ts +30 -31
- package/dist/automations/service.d.ts +20 -17
- package/dist/automations/service.js +91 -62
- package/dist/automations/service.js.map +1 -1
- package/dist/content/event-sight.d.ts +11 -0
- package/dist/content/event-sight.js +11 -0
- package/dist/content/event-sight.js.map +1 -0
- package/dist/content/events.d.ts +413 -72
- package/dist/content/events.js +34 -1
- package/dist/content/events.js.map +1 -1
- package/dist/content/index.d.ts +6 -4
- package/dist/content/index.js +3 -1
- package/dist/content/jobs.d.ts +16 -0
- package/dist/content/jobs.js +37 -0
- package/dist/content/jobs.js.map +1 -0
- package/dist/content/model.d.ts +2 -2
- package/dist/content/notification-categories.d.ts +5 -4
- package/dist/content/notification-categories.js +15 -6
- package/dist/content/notification-categories.js.map +1 -1
- package/dist/content/ports.d.ts +113 -68
- package/dist/content/service.d.ts +99 -67
- package/dist/content/service.js +680 -139
- package/dist/content/service.js.map +1 -1
- package/dist/content/titles.d.ts +6 -3
- package/dist/content/titles.js +37 -24
- package/dist/content/titles.js.map +1 -1
- package/dist/content/types.d.ts +2 -2
- package/dist/discussion/authors.d.ts +4 -2
- package/dist/discussion/authors.js +9 -5
- package/dist/discussion/authors.js.map +1 -1
- package/dist/discussion/chats.d.ts +56 -37
- package/dist/discussion/chats.js +393 -161
- package/dist/discussion/chats.js.map +1 -1
- package/dist/discussion/events.d.ts +77 -39
- package/dist/discussion/events.js +41 -3
- package/dist/discussion/events.js.map +1 -1
- package/dist/discussion/index.d.ts +8 -5
- package/dist/discussion/index.js +5 -3
- package/dist/discussion/live.d.ts +106 -0
- package/dist/discussion/live.js +642 -0
- package/dist/discussion/live.js.map +1 -0
- package/dist/discussion/mentions.js +2 -2
- package/dist/discussion/mentions.js.map +1 -1
- package/dist/discussion/ports.d.ts +182 -100
- package/dist/discussion/ports.js.map +1 -1
- package/dist/discussion/posts.d.ts +45 -39
- package/dist/discussion/posts.js +268 -154
- package/dist/discussion/posts.js.map +1 -1
- package/dist/discussion/rules.d.ts +18 -0
- package/dist/discussion/rules.js +22 -0
- package/dist/discussion/rules.js.map +1 -0
- package/dist/discussion/service.d.ts +37 -31
- package/dist/discussion/service.js +252 -188
- package/dist/discussion/service.js.map +1 -1
- package/dist/discussion/subscriptions.d.ts +8 -8
- package/dist/discussion/subscriptions.js +29 -13
- package/dist/discussion/subscriptions.js.map +1 -1
- package/dist/discussion/titles.d.ts +4 -2
- package/dist/discussion/titles.js +27 -13
- package/dist/discussion/titles.js.map +1 -1
- package/dist/entitlements/events.d.ts +20 -20
- package/dist/entitlements/index.d.ts +4 -4
- package/dist/entitlements/index.js +2 -2
- package/dist/entitlements/model.d.ts +2 -2
- package/dist/entitlements/ports.d.ts +65 -39
- package/dist/entitlements/rules.d.ts +3 -6
- package/dist/entitlements/rules.js +5 -10
- package/dist/entitlements/rules.js.map +1 -1
- package/dist/entitlements/service.d.ts +40 -28
- package/dist/entitlements/service.js +370 -163
- package/dist/entitlements/service.js.map +1 -1
- package/dist/identity/devices.d.ts +3 -3
- package/dist/identity/devices.js +7 -5
- package/dist/identity/devices.js.map +1 -1
- package/dist/identity/events.d.ts +2 -2
- package/dist/identity/index.d.ts +2 -2
- package/dist/identity/index.js +2 -2
- package/dist/identity/notification-settings.d.ts +1 -1
- package/dist/identity/notification-settings.js +3 -2
- package/dist/identity/notification-settings.js.map +1 -1
- package/dist/identity/ports.d.ts +7 -7
- package/dist/identity/service.d.ts +8 -7
- package/dist/identity/service.js +17 -13
- package/dist/identity/service.js.map +1 -1
- package/dist/integrations/events.d.ts +3 -3
- package/dist/integrations/ports.d.ts +9 -8
- package/dist/integrations/service.d.ts +9 -8
- package/dist/integrations/service.js +33 -16
- package/dist/integrations/service.js.map +1 -1
- package/dist/organizations/default-roles.d.ts +22 -0
- package/dist/organizations/default-roles.js +89 -0
- package/dist/organizations/default-roles.js.map +1 -0
- package/dist/organizations/effective-permissions.d.ts +45 -0
- package/dist/organizations/effective-permissions.js +113 -0
- package/dist/organizations/effective-permissions.js.map +1 -0
- package/dist/organizations/events.d.ts +320 -181
- package/dist/organizations/events.js +90 -18
- package/dist/organizations/events.js.map +1 -1
- package/dist/organizations/index.d.ts +14 -10
- package/dist/organizations/index.js +7 -3
- package/dist/organizations/members.d.ts +66 -8
- package/dist/organizations/members.js.map +1 -1
- package/dist/organizations/notification-catalog.d.ts +31 -0
- package/dist/organizations/notification-catalog.js +32 -0
- package/dist/organizations/notification-catalog.js.map +1 -0
- package/dist/organizations/notification-categories.d.ts +6 -4
- package/dist/organizations/notification-categories.js +25 -10
- package/dist/organizations/notification-categories.js.map +1 -1
- package/dist/organizations/org-roles.d.ts +33 -0
- package/dist/organizations/org-roles.js +49 -0
- package/dist/organizations/org-roles.js.map +1 -0
- package/dist/organizations/permissions.d.ts +311 -0
- package/dist/organizations/permissions.js +327 -0
- package/dist/organizations/permissions.js.map +1 -0
- package/dist/organizations/ports.d.ts +184 -65
- package/dist/organizations/service.d.ts +102 -35
- package/dist/organizations/service.js +1245 -328
- package/dist/organizations/service.js.map +1 -1
- package/dist/organizations/testing.d.ts +18 -0
- package/dist/organizations/testing.js +37 -0
- package/dist/organizations/testing.js.map +1 -0
- package/dist/organizations/types.d.ts +5 -16
- package/dist/progress/events.d.ts +14 -14
- package/dist/progress/index.d.ts +2 -2
- package/dist/progress/ports.d.ts +11 -3
- package/dist/progress/service.d.ts +6 -5
- package/dist/progress/service.js +23 -8
- package/dist/progress/service.js.map +1 -1
- package/dist/reporting/admin/index.d.ts +6 -4
- package/dist/reporting/admin/model.d.ts +36 -3
- package/dist/reporting/admin/ports.d.ts +39 -14
- package/dist/reporting/admin/service.d.ts +32 -11
- package/dist/reporting/admin/service.js +102 -18
- package/dist/reporting/admin/service.js.map +1 -1
- package/dist/reporting/events/index.d.ts +27 -0
- package/dist/reporting/events/index.js +20 -0
- package/dist/reporting/events/index.js.map +1 -0
- package/dist/reporting/member/calendar.d.ts +11 -0
- package/dist/reporting/member/calendar.js +75 -0
- package/dist/reporting/member/calendar.js.map +1 -0
- package/dist/reporting/member/index.d.ts +3 -2
- package/dist/reporting/member/model.d.ts +26 -5
- package/dist/reporting/member/ports.d.ts +48 -29
- package/dist/reporting/member/service.d.ts +56 -29
- package/dist/reporting/member/service.js +328 -113
- package/dist/reporting/member/service.js.map +1 -1
- package/dist/shared/actor.d.ts +22 -3
- package/dist/shared/errors.d.ts +2 -1
- package/dist/shared/errors.js +3 -1
- package/dist/shared/errors.js.map +1 -1
- package/dist/shared/id.d.ts +4 -0
- package/dist/shared/id.js +4 -0
- package/dist/shared/id.js.map +1 -1
- package/dist/shared/logger.d.ts +2 -1
- package/dist/shared/logger.js +10 -1
- package/dist/shared/logger.js.map +1 -1
- package/dist/shared/ports.d.ts +25 -5
- package/dist/types/content.d.ts +2 -2
- package/dist/types/discussion.d.ts +4 -5
- package/dist/types/email-templates.d.ts +22 -3
- package/dist/types/entitlements.d.ts +2 -2
- package/dist/types/identity.d.ts +13 -16
- package/dist/types/index.d.ts +9 -9
- package/dist/types/index.js +2 -1
- package/dist/types/notifications.d.ts +4 -4
- package/dist/types/organizations.d.ts +3 -2
- package/dist/types/ports.d.ts +8 -1
- package/dist/types/ports.js +7 -1
- package/dist/types/ports.js.map +1 -0
- package/dist/types/schemas/assets.d.ts +5 -5
- package/dist/types/schemas/assets.js +4 -3
- package/dist/types/schemas/assets.js.map +1 -1
- package/dist/types/schemas/content.d.ts +537 -13
- package/dist/types/schemas/content.js +201 -7
- package/dist/types/schemas/content.js.map +1 -1
- package/dist/types/schemas/discussion.d.ts +282 -59
- package/dist/types/schemas/discussion.js +77 -3
- package/dist/types/schemas/discussion.js.map +1 -1
- package/dist/types/schemas/entitlements.d.ts +14 -1
- package/dist/types/schemas/entitlements.js +11 -4
- package/dist/types/schemas/entitlements.js.map +1 -1
- package/dist/types/schemas/index.d.ts +5 -5
- package/dist/types/schemas/index.js +5 -5
- package/dist/types/schemas/notifications.d.ts +13 -12
- package/dist/types/schemas/notifications.js +3 -2
- package/dist/types/schemas/notifications.js.map +1 -1
- package/dist/types/schemas/organizations.d.ts +96 -60
- package/dist/types/schemas/organizations.js +78 -27
- package/dist/types/schemas/organizations.js.map +1 -1
- package/dist/types/schemas/progress.d.ts +3 -4
- package/dist/types/schemas/progress.js +0 -1
- package/dist/types/schemas/progress.js.map +1 -1
- package/package.json +1 -1
- package/dist/organizations/access-scopes.d.ts +0 -19
- package/dist/organizations/access-scopes.js +0 -89
- package/dist/organizations/access-scopes.js.map +0 -1
- package/dist/organizations/roles.d.ts +0 -19
- package/dist/organizations/roles.js +0 -82
- package/dist/organizations/roles.js.map +0 -1
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { PERMISSION_KEYS } from "../types/schemas/organizations.js";
|
|
2
|
+
//#region src/organizations/permissions.ts
|
|
3
|
+
const PERMISSIONS = {
|
|
4
|
+
"organizations:read": {
|
|
5
|
+
group: "organization",
|
|
6
|
+
label: "See the organization",
|
|
7
|
+
description: "See the org's name, slug and general settings.",
|
|
8
|
+
about: "org"
|
|
9
|
+
},
|
|
10
|
+
"organizations:write": {
|
|
11
|
+
group: "organization",
|
|
12
|
+
label: "Edit the organization",
|
|
13
|
+
description: "Change the org's name, slug and general settings.",
|
|
14
|
+
about: "org",
|
|
15
|
+
implies: ["organizations:read"]
|
|
16
|
+
},
|
|
17
|
+
"api_keys:read": {
|
|
18
|
+
group: "organization",
|
|
19
|
+
label: "See your API keys",
|
|
20
|
+
description: "List your own API keys.",
|
|
21
|
+
about: "org"
|
|
22
|
+
},
|
|
23
|
+
"api_keys:write": {
|
|
24
|
+
group: "organization",
|
|
25
|
+
label: "Create API keys",
|
|
26
|
+
description: "Create your own API keys.",
|
|
27
|
+
about: "org",
|
|
28
|
+
implies: ["api_keys:read"]
|
|
29
|
+
},
|
|
30
|
+
"api_keys:delete": {
|
|
31
|
+
group: "organization",
|
|
32
|
+
label: "Revoke API keys",
|
|
33
|
+
description: "Revoke your own API keys.",
|
|
34
|
+
about: "org",
|
|
35
|
+
implies: ["api_keys:read"]
|
|
36
|
+
},
|
|
37
|
+
"notification_categories:read": {
|
|
38
|
+
group: "organization",
|
|
39
|
+
label: "See notification categories",
|
|
40
|
+
description: "See the notification types, channels and the org's categories and defaults.",
|
|
41
|
+
about: "org"
|
|
42
|
+
},
|
|
43
|
+
"notification_categories:write": {
|
|
44
|
+
group: "organization",
|
|
45
|
+
label: "Edit notification categories",
|
|
46
|
+
description: "Edit and reset the org's notification categories.",
|
|
47
|
+
about: "org",
|
|
48
|
+
implies: ["notification_categories:read"]
|
|
49
|
+
},
|
|
50
|
+
"integrations:read": {
|
|
51
|
+
group: "organization",
|
|
52
|
+
label: "See integrations",
|
|
53
|
+
description: "See connected integrations.",
|
|
54
|
+
about: "org"
|
|
55
|
+
},
|
|
56
|
+
"integrations:write": {
|
|
57
|
+
group: "organization",
|
|
58
|
+
label: "Manage integrations",
|
|
59
|
+
description: "Connect, configure and run actions on integrations.",
|
|
60
|
+
about: "org",
|
|
61
|
+
implies: ["integrations:read"]
|
|
62
|
+
},
|
|
63
|
+
"integrations:delete": {
|
|
64
|
+
group: "organization",
|
|
65
|
+
label: "Disconnect integrations",
|
|
66
|
+
description: "Disconnect integrations.",
|
|
67
|
+
about: "org",
|
|
68
|
+
implies: ["integrations:read"]
|
|
69
|
+
},
|
|
70
|
+
"analytics:read": {
|
|
71
|
+
group: "organization",
|
|
72
|
+
label: "See the overview",
|
|
73
|
+
description: "See the org's overview report.",
|
|
74
|
+
about: "org"
|
|
75
|
+
},
|
|
76
|
+
"people:read": {
|
|
77
|
+
group: "people",
|
|
78
|
+
label: "See people",
|
|
79
|
+
description: "List the org's people and pending invites, with each person's roles, and open any person's record.",
|
|
80
|
+
about: "org",
|
|
81
|
+
implies: ["progress:read"]
|
|
82
|
+
},
|
|
83
|
+
"people:write": {
|
|
84
|
+
group: "people",
|
|
85
|
+
label: "Manage people",
|
|
86
|
+
description: "Invite people, resend and cancel invites, set a person's org role and give and remove roles on content items.",
|
|
87
|
+
about: "org",
|
|
88
|
+
implies: ["people:read"]
|
|
89
|
+
},
|
|
90
|
+
"people:delete": {
|
|
91
|
+
group: "people",
|
|
92
|
+
label: "Remove people",
|
|
93
|
+
description: "Remove a person from the org.",
|
|
94
|
+
about: "org",
|
|
95
|
+
implies: ["people:read"]
|
|
96
|
+
},
|
|
97
|
+
"roles:read": {
|
|
98
|
+
group: "people",
|
|
99
|
+
label: "See roles",
|
|
100
|
+
description: "See the org's roles and their permissions.",
|
|
101
|
+
about: "org"
|
|
102
|
+
},
|
|
103
|
+
"roles:write": {
|
|
104
|
+
group: "people",
|
|
105
|
+
label: "Manage roles",
|
|
106
|
+
description: "Rename roles; change, reset and add roles through the API.",
|
|
107
|
+
about: "org",
|
|
108
|
+
implies: ["roles:read"]
|
|
109
|
+
},
|
|
110
|
+
"roles:delete": {
|
|
111
|
+
group: "people",
|
|
112
|
+
label: "Delete roles",
|
|
113
|
+
description: "Delete a role the org added.",
|
|
114
|
+
about: "org",
|
|
115
|
+
implies: ["roles:read"]
|
|
116
|
+
},
|
|
117
|
+
"access:read": {
|
|
118
|
+
group: "access",
|
|
119
|
+
label: "See access",
|
|
120
|
+
description: "See grants, including a community's roster of grant holders.",
|
|
121
|
+
about: "org"
|
|
122
|
+
},
|
|
123
|
+
"access:write": {
|
|
124
|
+
group: "access",
|
|
125
|
+
label: "Manage access",
|
|
126
|
+
description: "Grant, change and revoke access.",
|
|
127
|
+
about: "org",
|
|
128
|
+
implies: ["access:read"]
|
|
129
|
+
},
|
|
130
|
+
"bundles:read": {
|
|
131
|
+
group: "content",
|
|
132
|
+
label: "See bundles",
|
|
133
|
+
description: "See bundles and their names.",
|
|
134
|
+
about: "org"
|
|
135
|
+
},
|
|
136
|
+
"bundles:write": {
|
|
137
|
+
group: "content",
|
|
138
|
+
label: "Edit bundles",
|
|
139
|
+
description: "Create and edit bundles.",
|
|
140
|
+
about: "org",
|
|
141
|
+
implies: ["bundles:read"]
|
|
142
|
+
},
|
|
143
|
+
"bundles:delete": {
|
|
144
|
+
group: "content",
|
|
145
|
+
label: "Delete bundles",
|
|
146
|
+
description: "Delete bundles.",
|
|
147
|
+
about: "org",
|
|
148
|
+
implies: ["bundles:read"]
|
|
149
|
+
},
|
|
150
|
+
"media:read": {
|
|
151
|
+
group: "content",
|
|
152
|
+
label: "See the media library",
|
|
153
|
+
description: "See the whole media library and attach any of its files.",
|
|
154
|
+
about: "org"
|
|
155
|
+
},
|
|
156
|
+
"media:write": {
|
|
157
|
+
group: "content",
|
|
158
|
+
label: "Upload media",
|
|
159
|
+
description: "Upload to the media library and edit its files.",
|
|
160
|
+
about: "org",
|
|
161
|
+
implies: ["media:read"]
|
|
162
|
+
},
|
|
163
|
+
"media:delete": {
|
|
164
|
+
group: "content",
|
|
165
|
+
label: "Delete media",
|
|
166
|
+
description: "Delete files from the media library.",
|
|
167
|
+
about: "org",
|
|
168
|
+
implies: ["media:read"]
|
|
169
|
+
},
|
|
170
|
+
"courses:read": {
|
|
171
|
+
group: "courses",
|
|
172
|
+
label: "See courses",
|
|
173
|
+
description: "See the course, its modules and activities in the admin app; open it, its lessons, files and titles without a grant, unpublished included; be reachable for its lesson-comment mentions.",
|
|
174
|
+
about: "course"
|
|
175
|
+
},
|
|
176
|
+
"courses:write": {
|
|
177
|
+
group: "courses",
|
|
178
|
+
label: "Edit courses",
|
|
179
|
+
description: "Edit and publish the course; add, change and delete its modules and activities; upload media for it and attach media uploaded for it. Creating a course needs it on the org.",
|
|
180
|
+
about: "course",
|
|
181
|
+
implies: ["courses:read"]
|
|
182
|
+
},
|
|
183
|
+
"courses:delete": {
|
|
184
|
+
group: "courses",
|
|
185
|
+
label: "Delete courses",
|
|
186
|
+
description: "Delete the course.",
|
|
187
|
+
about: "course",
|
|
188
|
+
implies: ["courses:read"]
|
|
189
|
+
},
|
|
190
|
+
"courses:moderate": {
|
|
191
|
+
group: "courses",
|
|
192
|
+
label: "Moderate lesson comments",
|
|
193
|
+
description: "See the course's lesson comments, held ones included; approve, remove, restore, reply to and resolve reports on them; be notified of reports. The holder's own lesson comments publish without review.",
|
|
194
|
+
about: "course",
|
|
195
|
+
implies: ["courses:read"]
|
|
196
|
+
},
|
|
197
|
+
"progress:read": {
|
|
198
|
+
group: "courses",
|
|
199
|
+
label: "See learners and progress",
|
|
200
|
+
description: "See the course's learners, their progress and the course's analytics.",
|
|
201
|
+
about: "course"
|
|
202
|
+
},
|
|
203
|
+
"downloads:read": {
|
|
204
|
+
group: "downloads",
|
|
205
|
+
label: "See downloads",
|
|
206
|
+
description: "See the download in the admin app, and open it and its files without a grant, unpublished included.",
|
|
207
|
+
about: "download"
|
|
208
|
+
},
|
|
209
|
+
"downloads:write": {
|
|
210
|
+
group: "downloads",
|
|
211
|
+
label: "Edit downloads",
|
|
212
|
+
description: "Edit and publish the download; upload files for it and attach files uploaded for it. Creating a download needs it on the org.",
|
|
213
|
+
about: "download",
|
|
214
|
+
implies: ["downloads:read"]
|
|
215
|
+
},
|
|
216
|
+
"downloads:delete": {
|
|
217
|
+
group: "downloads",
|
|
218
|
+
label: "Delete downloads",
|
|
219
|
+
description: "Delete the download.",
|
|
220
|
+
about: "download",
|
|
221
|
+
implies: ["downloads:read"]
|
|
222
|
+
},
|
|
223
|
+
"communities:read": {
|
|
224
|
+
group: "communities",
|
|
225
|
+
label: "See communities",
|
|
226
|
+
description: "See the community, its spaces, notification categories and analytics in the admin app; be a member of it without a grant, unpublished included, open every space in it and see its thumbnail while unpublished.",
|
|
227
|
+
about: "community"
|
|
228
|
+
},
|
|
229
|
+
"communities:write": {
|
|
230
|
+
group: "communities",
|
|
231
|
+
label: "Configure communities",
|
|
232
|
+
description: "Configure the community, its spaces, topics, links, settings and notification categories; publish it; delete its spaces; upload media for it and attach media uploaded for it. Creating a community needs it on the org.",
|
|
233
|
+
about: "community",
|
|
234
|
+
implies: ["communities:read"]
|
|
235
|
+
},
|
|
236
|
+
"communities:delete": {
|
|
237
|
+
group: "communities",
|
|
238
|
+
label: "Delete communities",
|
|
239
|
+
description: "Delete the community.",
|
|
240
|
+
about: "community",
|
|
241
|
+
implies: ["communities:read"]
|
|
242
|
+
},
|
|
243
|
+
"communities:moderate": {
|
|
244
|
+
group: "communities",
|
|
245
|
+
label: "Moderate communities",
|
|
246
|
+
description: "See the review queue, pending and removed posts, held comments and their titles; open every space; approve, remove, restore, pin and lock posts and comments; turn comments and reactions on and off; delete any message, see deleted messages, read reported attachments, lock chats, see the message queue; see every space member and locked spaces' rosters; invite, add, approve, decline and remove space members; resolve reports; be notified of reviews, reports and join requests. The holder's own posts publish without review.",
|
|
247
|
+
about: "community"
|
|
248
|
+
},
|
|
249
|
+
"events:read": {
|
|
250
|
+
group: "events",
|
|
251
|
+
label: "See events",
|
|
252
|
+
description: "See the event in the admin app, drafts and canceled included; open it without a grant; see its attendees and analytics.",
|
|
253
|
+
about: "event"
|
|
254
|
+
},
|
|
255
|
+
"events:write": {
|
|
256
|
+
group: "events",
|
|
257
|
+
label: "Edit events",
|
|
258
|
+
description: "Edit, publish and cancel the event; set its recording; grant and revoke it for others; upload files for it and attach, rename, reorder and remove them. Creating an event needs it on the org.",
|
|
259
|
+
about: "event",
|
|
260
|
+
implies: ["events:read"]
|
|
261
|
+
},
|
|
262
|
+
"events:delete": {
|
|
263
|
+
group: "events",
|
|
264
|
+
label: "Delete events",
|
|
265
|
+
description: "Delete the event.",
|
|
266
|
+
about: "event",
|
|
267
|
+
implies: ["events:read"]
|
|
268
|
+
},
|
|
269
|
+
"automations:read": {
|
|
270
|
+
group: "automations",
|
|
271
|
+
label: "See automations",
|
|
272
|
+
description: "See workflows, webhooks and their runs.",
|
|
273
|
+
about: "org"
|
|
274
|
+
},
|
|
275
|
+
"automations:write": {
|
|
276
|
+
group: "automations",
|
|
277
|
+
label: "Edit automations",
|
|
278
|
+
description: "Create and edit workflows and webhooks, and reveal a webhook's signing secret.",
|
|
279
|
+
about: "org",
|
|
280
|
+
implies: ["automations:read"]
|
|
281
|
+
},
|
|
282
|
+
"automations:delete": {
|
|
283
|
+
group: "automations",
|
|
284
|
+
label: "Delete automations",
|
|
285
|
+
description: "Delete workflows and webhooks.",
|
|
286
|
+
about: "org",
|
|
287
|
+
implies: ["automations:read"]
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
const ALL_PERMISSIONS = PERMISSION_KEYS;
|
|
291
|
+
function isPermission(value) {
|
|
292
|
+
return PERMISSION_KEYS.includes(value);
|
|
293
|
+
}
|
|
294
|
+
function permissionAbout(permission) {
|
|
295
|
+
return PERMISSIONS[permission].about;
|
|
296
|
+
}
|
|
297
|
+
function fitsLevels(permission, levels) {
|
|
298
|
+
const about = permissionAbout(permission);
|
|
299
|
+
if (levels.includes("org")) return true;
|
|
300
|
+
return about !== "org" && levels.includes(about);
|
|
301
|
+
}
|
|
302
|
+
function withImplied(permissions) {
|
|
303
|
+
const out = /* @__PURE__ */ new Set();
|
|
304
|
+
const queue = [...permissions];
|
|
305
|
+
while (queue.length > 0) {
|
|
306
|
+
const next = queue.pop();
|
|
307
|
+
if (out.has(next)) continue;
|
|
308
|
+
out.add(next);
|
|
309
|
+
const def = PERMISSIONS[next];
|
|
310
|
+
for (const implied of def.implies ?? []) queue.push(implied);
|
|
311
|
+
}
|
|
312
|
+
return out;
|
|
313
|
+
}
|
|
314
|
+
function permissionList() {
|
|
315
|
+
return PERMISSION_KEYS.map((key) => {
|
|
316
|
+
const { implies, ...definition } = PERMISSIONS[key];
|
|
317
|
+
return {
|
|
318
|
+
key,
|
|
319
|
+
...definition,
|
|
320
|
+
...implies && { implies: [...implies] }
|
|
321
|
+
};
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
//#endregion
|
|
325
|
+
export { ALL_PERMISSIONS, PERMISSIONS, fitsLevels, isPermission, permissionAbout, permissionList, withImplied };
|
|
326
|
+
|
|
327
|
+
//# sourceMappingURL=permissions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permissions.js","names":[],"sources":["../../src/organizations/permissions.ts"],"sourcesContent":["import { PERMISSION_KEYS } from '../types/schemas/organizations.js';\nimport type { Level, Permission } from '../types/index.js';\n\nexport type PermissionGroup =\n | 'organization'\n | 'people'\n | 'access'\n | 'content'\n | 'courses'\n | 'downloads'\n | 'communities'\n | 'events'\n | 'automations';\n\nexport interface PermissionDefinition {\n group: PermissionGroup;\n label: string;\n description: string;\n about: Level;\n implies?: readonly Permission[];\n}\n\nexport const PERMISSIONS = {\n 'organizations:read': {\n group: 'organization',\n label: 'See the organization',\n description: \"See the org's name, slug and general settings.\",\n about: 'org',\n },\n 'organizations:write': {\n group: 'organization',\n label: 'Edit the organization',\n description: \"Change the org's name, slug and general settings.\",\n about: 'org',\n implies: ['organizations:read'],\n },\n 'api_keys:read': {\n group: 'organization',\n label: 'See your API keys',\n description: 'List your own API keys.',\n about: 'org',\n },\n 'api_keys:write': {\n group: 'organization',\n label: 'Create API keys',\n description: 'Create your own API keys.',\n about: 'org',\n implies: ['api_keys:read'],\n },\n 'api_keys:delete': {\n group: 'organization',\n label: 'Revoke API keys',\n description: 'Revoke your own API keys.',\n about: 'org',\n implies: ['api_keys:read'],\n },\n 'notification_categories:read': {\n group: 'organization',\n label: 'See notification categories',\n description: \"See the notification types, channels and the org's categories and defaults.\",\n about: 'org',\n },\n 'notification_categories:write': {\n group: 'organization',\n label: 'Edit notification categories',\n description: \"Edit and reset the org's notification categories.\",\n about: 'org',\n implies: ['notification_categories:read'],\n },\n 'integrations:read': {\n group: 'organization',\n label: 'See integrations',\n description: 'See connected integrations.',\n about: 'org',\n },\n 'integrations:write': {\n group: 'organization',\n label: 'Manage integrations',\n description: 'Connect, configure and run actions on integrations.',\n about: 'org',\n implies: ['integrations:read'],\n },\n 'integrations:delete': {\n group: 'organization',\n label: 'Disconnect integrations',\n description: 'Disconnect integrations.',\n about: 'org',\n implies: ['integrations:read'],\n },\n 'analytics:read': {\n group: 'organization',\n label: 'See the overview',\n description: \"See the org's overview report.\",\n about: 'org',\n },\n 'people:read': {\n group: 'people',\n label: 'See people',\n description:\n \"List the org's people and pending invites, with each person's roles, and open any person's record.\",\n about: 'org',\n implies: ['progress:read'],\n },\n 'people:write': {\n group: 'people',\n label: 'Manage people',\n description:\n \"Invite people, resend and cancel invites, set a person's org role and give and remove roles on content items.\",\n about: 'org',\n implies: ['people:read'],\n },\n 'people:delete': {\n group: 'people',\n label: 'Remove people',\n description: 'Remove a person from the org.',\n about: 'org',\n implies: ['people:read'],\n },\n 'roles:read': {\n group: 'people',\n label: 'See roles',\n description: \"See the org's roles and their permissions.\",\n about: 'org',\n },\n 'roles:write': {\n group: 'people',\n label: 'Manage roles',\n description: 'Rename roles; change, reset and add roles through the API.',\n about: 'org',\n implies: ['roles:read'],\n },\n 'roles:delete': {\n group: 'people',\n label: 'Delete roles',\n description: 'Delete a role the org added.',\n about: 'org',\n implies: ['roles:read'],\n },\n 'access:read': {\n group: 'access',\n label: 'See access',\n description: \"See grants, including a community's roster of grant holders.\",\n about: 'org',\n },\n 'access:write': {\n group: 'access',\n label: 'Manage access',\n description: 'Grant, change and revoke access.',\n about: 'org',\n implies: ['access:read'],\n },\n 'bundles:read': {\n group: 'content',\n label: 'See bundles',\n description: 'See bundles and their names.',\n about: 'org',\n },\n 'bundles:write': {\n group: 'content',\n label: 'Edit bundles',\n description: 'Create and edit bundles.',\n about: 'org',\n implies: ['bundles:read'],\n },\n 'bundles:delete': {\n group: 'content',\n label: 'Delete bundles',\n description: 'Delete bundles.',\n about: 'org',\n implies: ['bundles:read'],\n },\n 'media:read': {\n group: 'content',\n label: 'See the media library',\n description: 'See the whole media library and attach any of its files.',\n about: 'org',\n },\n 'media:write': {\n group: 'content',\n label: 'Upload media',\n description: 'Upload to the media library and edit its files.',\n about: 'org',\n implies: ['media:read'],\n },\n 'media:delete': {\n group: 'content',\n label: 'Delete media',\n description: 'Delete files from the media library.',\n about: 'org',\n implies: ['media:read'],\n },\n 'courses:read': {\n group: 'courses',\n label: 'See courses',\n description:\n 'See the course, its modules and activities in the admin app; open it, its lessons, files and titles without a grant, unpublished included; be reachable for its lesson-comment mentions.',\n about: 'course',\n },\n 'courses:write': {\n group: 'courses',\n label: 'Edit courses',\n description:\n 'Edit and publish the course; add, change and delete its modules and activities; upload media for it and attach media uploaded for it. Creating a course needs it on the org.',\n about: 'course',\n implies: ['courses:read'],\n },\n 'courses:delete': {\n group: 'courses',\n label: 'Delete courses',\n description: 'Delete the course.',\n about: 'course',\n implies: ['courses:read'],\n },\n 'courses:moderate': {\n group: 'courses',\n label: 'Moderate lesson comments',\n description:\n \"See the course's lesson comments, held ones included; approve, remove, restore, reply to and resolve reports on them; be notified of reports. The holder's own lesson comments publish without review.\",\n about: 'course',\n implies: ['courses:read'],\n },\n 'progress:read': {\n group: 'courses',\n label: 'See learners and progress',\n description: \"See the course's learners, their progress and the course's analytics.\",\n about: 'course',\n },\n 'downloads:read': {\n group: 'downloads',\n label: 'See downloads',\n description:\n 'See the download in the admin app, and open it and its files without a grant, unpublished included.',\n about: 'download',\n },\n 'downloads:write': {\n group: 'downloads',\n label: 'Edit downloads',\n description:\n 'Edit and publish the download; upload files for it and attach files uploaded for it. Creating a download needs it on the org.',\n about: 'download',\n implies: ['downloads:read'],\n },\n 'downloads:delete': {\n group: 'downloads',\n label: 'Delete downloads',\n description: 'Delete the download.',\n about: 'download',\n implies: ['downloads:read'],\n },\n 'communities:read': {\n group: 'communities',\n label: 'See communities',\n description:\n 'See the community, its spaces, notification categories and analytics in the admin app; be a member of it without a grant, unpublished included, open every space in it and see its thumbnail while unpublished.',\n about: 'community',\n },\n 'communities:write': {\n group: 'communities',\n label: 'Configure communities',\n description:\n 'Configure the community, its spaces, topics, links, settings and notification categories; publish it; delete its spaces; upload media for it and attach media uploaded for it. Creating a community needs it on the org.',\n about: 'community',\n implies: ['communities:read'],\n },\n 'communities:delete': {\n group: 'communities',\n label: 'Delete communities',\n description: 'Delete the community.',\n about: 'community',\n implies: ['communities:read'],\n },\n 'communities:moderate': {\n group: 'communities',\n label: 'Moderate communities',\n description:\n \"See the review queue, pending and removed posts, held comments and their titles; open every space; approve, remove, restore, pin and lock posts and comments; turn comments and reactions on and off; delete any message, see deleted messages, read reported attachments, lock chats, see the message queue; see every space member and locked spaces' rosters; invite, add, approve, decline and remove space members; resolve reports; be notified of reviews, reports and join requests. The holder's own posts publish without review.\",\n about: 'community',\n },\n 'events:read': {\n group: 'events',\n label: 'See events',\n description:\n 'See the event in the admin app, drafts and canceled included; open it without a grant; see its attendees and analytics.',\n about: 'event',\n },\n 'events:write': {\n group: 'events',\n label: 'Edit events',\n description:\n 'Edit, publish and cancel the event; set its recording; grant and revoke it for others; upload files for it and attach, rename, reorder and remove them. Creating an event needs it on the org.',\n about: 'event',\n implies: ['events:read'],\n },\n 'events:delete': {\n group: 'events',\n label: 'Delete events',\n description: 'Delete the event.',\n about: 'event',\n implies: ['events:read'],\n },\n 'automations:read': {\n group: 'automations',\n label: 'See automations',\n description: 'See workflows, webhooks and their runs.',\n about: 'org',\n },\n 'automations:write': {\n group: 'automations',\n label: 'Edit automations',\n description: \"Create and edit workflows and webhooks, and reveal a webhook's signing secret.\",\n about: 'org',\n implies: ['automations:read'],\n },\n 'automations:delete': {\n group: 'automations',\n label: 'Delete automations',\n description: 'Delete workflows and webhooks.',\n about: 'org',\n implies: ['automations:read'],\n },\n} as const satisfies Record<Permission, PermissionDefinition>;\n\nexport const ALL_PERMISSIONS: readonly Permission[] = PERMISSION_KEYS;\n\nexport function isPermission(value: string): value is Permission {\n return (PERMISSION_KEYS as readonly string[]).includes(value);\n}\n\nexport function permissionAbout(permission: Permission): Level {\n return PERMISSIONS[permission].about;\n}\n\nexport function fitsLevels(permission: Permission, levels: readonly Level[]): boolean {\n const about = permissionAbout(permission);\n if (levels.includes('org')) {\n return true;\n }\n return about !== 'org' && levels.includes(about);\n}\n\nexport function withImplied(permissions: Iterable<Permission>): Set<Permission> {\n const out = new Set<Permission>();\n const queue = [...permissions];\n while (queue.length > 0) {\n const next = queue.pop()!;\n if (out.has(next)) {\n continue;\n }\n out.add(next);\n const def: PermissionDefinition = PERMISSIONS[next];\n for (const implied of def.implies ?? []) {\n queue.push(implied);\n }\n }\n return out;\n}\n\nexport interface PermissionListEntry extends Omit<PermissionDefinition, 'implies'> {\n key: Permission;\n implies?: Permission[];\n}\n\nexport function permissionList(): PermissionListEntry[] {\n return PERMISSION_KEYS.map((key) => {\n const { implies, ...definition }: PermissionDefinition = PERMISSIONS[key];\n return { key, ...definition, ...(implies && { implies: [...implies] }) };\n });\n}\n"],"mappings":";;AAsBA,MAAa,cAAc;CACzB,sBAAsB;EACpB,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;CACT;CACA,uBAAuB;EACrB,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;EACP,SAAS,CAAC,oBAAoB;CAChC;CACA,iBAAiB;EACf,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;CACT;CACA,kBAAkB;EAChB,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;EACP,SAAS,CAAC,eAAe;CAC3B;CACA,mBAAmB;EACjB,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;EACP,SAAS,CAAC,eAAe;CAC3B;CACA,gCAAgC;EAC9B,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;CACT;CACA,iCAAiC;EAC/B,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;EACP,SAAS,CAAC,8BAA8B;CAC1C;CACA,qBAAqB;EACnB,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;CACT;CACA,sBAAsB;EACpB,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;EACP,SAAS,CAAC,mBAAmB;CAC/B;CACA,uBAAuB;EACrB,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;EACP,SAAS,CAAC,mBAAmB;CAC/B;CACA,kBAAkB;EAChB,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;CACT;CACA,eAAe;EACb,OAAO;EACP,OAAO;EACP,aACE;EACF,OAAO;EACP,SAAS,CAAC,eAAe;CAC3B;CACA,gBAAgB;EACd,OAAO;EACP,OAAO;EACP,aACE;EACF,OAAO;EACP,SAAS,CAAC,aAAa;CACzB;CACA,iBAAiB;EACf,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;EACP,SAAS,CAAC,aAAa;CACzB;CACA,cAAc;EACZ,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;CACT;CACA,eAAe;EACb,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;EACP,SAAS,CAAC,YAAY;CACxB;CACA,gBAAgB;EACd,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;EACP,SAAS,CAAC,YAAY;CACxB;CACA,eAAe;EACb,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;CACT;CACA,gBAAgB;EACd,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;EACP,SAAS,CAAC,aAAa;CACzB;CACA,gBAAgB;EACd,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;CACT;CACA,iBAAiB;EACf,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;EACP,SAAS,CAAC,cAAc;CAC1B;CACA,kBAAkB;EAChB,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;EACP,SAAS,CAAC,cAAc;CAC1B;CACA,cAAc;EACZ,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;CACT;CACA,eAAe;EACb,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;EACP,SAAS,CAAC,YAAY;CACxB;CACA,gBAAgB;EACd,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;EACP,SAAS,CAAC,YAAY;CACxB;CACA,gBAAgB;EACd,OAAO;EACP,OAAO;EACP,aACE;EACF,OAAO;CACT;CACA,iBAAiB;EACf,OAAO;EACP,OAAO;EACP,aACE;EACF,OAAO;EACP,SAAS,CAAC,cAAc;CAC1B;CACA,kBAAkB;EAChB,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;EACP,SAAS,CAAC,cAAc;CAC1B;CACA,oBAAoB;EAClB,OAAO;EACP,OAAO;EACP,aACE;EACF,OAAO;EACP,SAAS,CAAC,cAAc;CAC1B;CACA,iBAAiB;EACf,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;CACT;CACA,kBAAkB;EAChB,OAAO;EACP,OAAO;EACP,aACE;EACF,OAAO;CACT;CACA,mBAAmB;EACjB,OAAO;EACP,OAAO;EACP,aACE;EACF,OAAO;EACP,SAAS,CAAC,gBAAgB;CAC5B;CACA,oBAAoB;EAClB,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;EACP,SAAS,CAAC,gBAAgB;CAC5B;CACA,oBAAoB;EAClB,OAAO;EACP,OAAO;EACP,aACE;EACF,OAAO;CACT;CACA,qBAAqB;EACnB,OAAO;EACP,OAAO;EACP,aACE;EACF,OAAO;EACP,SAAS,CAAC,kBAAkB;CAC9B;CACA,sBAAsB;EACpB,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;EACP,SAAS,CAAC,kBAAkB;CAC9B;CACA,wBAAwB;EACtB,OAAO;EACP,OAAO;EACP,aACE;EACF,OAAO;CACT;CACA,eAAe;EACb,OAAO;EACP,OAAO;EACP,aACE;EACF,OAAO;CACT;CACA,gBAAgB;EACd,OAAO;EACP,OAAO;EACP,aACE;EACF,OAAO;EACP,SAAS,CAAC,aAAa;CACzB;CACA,iBAAiB;EACf,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;EACP,SAAS,CAAC,aAAa;CACzB;CACA,oBAAoB;EAClB,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;CACT;CACA,qBAAqB;EACnB,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;EACP,SAAS,CAAC,kBAAkB;CAC9B;CACA,sBAAsB;EACpB,OAAO;EACP,OAAO;EACP,aAAa;EACb,OAAO;EACP,SAAS,CAAC,kBAAkB;CAC9B;AACF;AAEA,MAAa,kBAAyC;AAEtD,SAAgB,aAAa,OAAoC;CAC/D,OAAQ,gBAAsC,SAAS,KAAK;AAC9D;AAEA,SAAgB,gBAAgB,YAA+B;CAC7D,OAAO,YAAY,WAAW,CAAC;AACjC;AAEA,SAAgB,WAAW,YAAwB,QAAmC;CACpF,MAAM,QAAQ,gBAAgB,UAAU;CACxC,IAAI,OAAO,SAAS,KAAK,GACvB,OAAO;CAET,OAAO,UAAU,SAAS,OAAO,SAAS,KAAK;AACjD;AAEA,SAAgB,YAAY,aAAoD;CAC9E,MAAM,sBAAM,IAAI,IAAgB;CAChC,MAAM,QAAQ,CAAC,GAAG,WAAW;CAC7B,OAAO,MAAM,SAAS,GAAG;EACvB,MAAM,OAAO,MAAM,IAAI;EACvB,IAAI,IAAI,IAAI,IAAI,GACd;EAEF,IAAI,IAAI,IAAI;EACZ,MAAM,MAA4B,YAAY;EAC9C,KAAK,MAAM,WAAW,IAAI,WAAW,CAAC,GACpC,MAAM,KAAK,OAAO;CAEtB;CACA,OAAO;AACT;AAOA,SAAgB,iBAAwC;CACtD,OAAO,gBAAgB,KAAK,QAAQ;EAClC,MAAM,EAAE,SAAS,GAAG,eAAqC,YAAY;EACrE,OAAO;GAAE;GAAK,GAAG;GAAY,GAAI,WAAW,EAAE,SAAS,CAAC,GAAG,OAAO,EAAE;EAAG;CACzE,CAAC;AACH"}
|