grm-shared-library 1.1.217 → 1.1.219

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 (34) hide show
  1. package/README.md +35 -0
  2. package/dist/cjs/modules/permission/data/permissions.data.js +34 -4
  3. package/dist/cjs/modules/permission/data/permissions.data.js.map +1 -1
  4. package/dist/cjs/modules/permission/enums/permission-actions.enum.js +133 -6
  5. package/dist/cjs/modules/permission/enums/permission-actions.enum.js.map +1 -1
  6. package/dist/cjs/modules/role/constants/billing-roles.js +29 -0
  7. package/dist/cjs/modules/role/constants/billing-roles.js.map +1 -0
  8. package/dist/cjs/modules/role/constants/roles-by-scope.js +2 -1
  9. package/dist/cjs/modules/role/constants/roles-by-scope.js.map +1 -1
  10. package/dist/cjs/modules/role/data/roles.data.js +258 -19
  11. package/dist/cjs/modules/role/data/roles.data.js.map +1 -1
  12. package/dist/cjs/modules/role/enums/role.enum.js +8 -0
  13. package/dist/cjs/modules/role/enums/role.enum.js.map +1 -1
  14. package/dist/cjs/modules/role/index.js +1 -0
  15. package/dist/cjs/modules/role/index.js.map +1 -1
  16. package/dist/esm/modules/permission/data/permissions.data.js +34 -4
  17. package/dist/esm/modules/permission/data/permissions.data.js.map +1 -1
  18. package/dist/esm/modules/permission/enums/permission-actions.enum.js +132 -5
  19. package/dist/esm/modules/permission/enums/permission-actions.enum.js.map +1 -1
  20. package/dist/esm/modules/role/constants/billing-roles.js +26 -0
  21. package/dist/esm/modules/role/constants/billing-roles.js.map +1 -0
  22. package/dist/esm/modules/role/constants/roles-by-scope.js +2 -1
  23. package/dist/esm/modules/role/constants/roles-by-scope.js.map +1 -1
  24. package/dist/esm/modules/role/data/roles.data.js +258 -19
  25. package/dist/esm/modules/role/data/roles.data.js.map +1 -1
  26. package/dist/esm/modules/role/enums/role.enum.js +8 -0
  27. package/dist/esm/modules/role/enums/role.enum.js.map +1 -1
  28. package/dist/esm/modules/role/index.js +1 -0
  29. package/dist/esm/modules/role/index.js.map +1 -1
  30. package/dist/types/modules/permission/enums/permission-actions.enum.d.ts +55 -3
  31. package/dist/types/modules/role/constants/billing-roles.d.ts +17 -0
  32. package/dist/types/modules/role/enums/role.enum.d.ts +8 -0
  33. package/dist/types/modules/role/index.d.ts +1 -0
  34. package/package.json +1 -1
@@ -159,6 +159,24 @@ export var PermissionActions;
159
159
  // is the first half of that one task.
160
160
  PermissionActions["MANAGE_TRACKING_OPERATIONS"] = "manage:tracking-operations";
161
161
  // Module: Billing
162
+ //
163
+ // Two kinds of action, and the difference is who may hold them:
164
+ //
165
+ // ORGANIZATION actions run an organization's own billing - its packages,
166
+ // clients, subscriptions and the money they bring in. clarion-billing
167
+ // scopes every one of them to the caller's organization. Granted to
168
+ // Organization:Owner, :Admin and :Billing-Admin; the reads to
169
+ // Organization:User.
170
+ //
171
+ // PLATFORM actions are the platform's own business: the commercial terms it
172
+ // sets each organization (billing config), settling revenue share with them,
173
+ // reconciling provider payouts, the cross-organization dashboards, and
174
+ // anything clarion-billing does not yet scope to one organization (premium
175
+ // trials, reading another user's entitlements). No role holds these; only
176
+ // Super-Admin's wildcard reaches them.
177
+ //
178
+ // roles.data.ts names both lists, and roles.spec.ts fails if an action in this
179
+ // module is in neither - a new billing action has to be placed deliberately.
162
180
  PermissionActions["CREATE_BENEFICIARY"] = "create:beneficiary";
163
181
  PermissionActions["READ_BENEFICIARY"] = "read:beneficiary";
164
182
  PermissionActions["UPDATE_BENEFICIARY"] = "update:beneficiary";
@@ -209,6 +227,30 @@ export var PermissionActions;
209
227
  PermissionActions["READ_SETTLEMENT"] = "read:settlement";
210
228
  PermissionActions["SEND_SETTLEMENT_INVOICE"] = "send:settlement-invoice";
211
229
  PermissionActions["MARK_SETTLEMENT_PAID"] = "mark:settlement-paid";
230
+ // Renewing a subscription: a fresh checkout for the next period. Its own
231
+ // action because it is the one subscription action a SUBSCRIBER takes on
232
+ // their own plan from the app - manual renewal where mobile money leaves
233
+ // nothing to charge automatically (UG/TZ) - as well as staff on the
234
+ // organization's behalf. clarion-billing lets the owner or the
235
+ // organization's billing staff renew, nobody else.
236
+ PermissionActions["RENEW_SUBSCRIPTION"] = "renew:subscription";
237
+ // Provider settlement batches: what Paystack and Flutterwave paid out,
238
+ // grouped by provider, country and currency, and reconciled against their
239
+ // reports. PLATFORM: the payouts are the platform's, not one organization's.
240
+ PermissionActions["READ_SETTLEMENT_BATCH"] = "read:settlement-batch";
241
+ PermissionActions["CREATE_SETTLEMENT_BATCH"] = "create:settlement-batch";
242
+ // Importing the provider's report, recording what it actually paid, and
243
+ // moving a batch through its statuses - the steps of reconciling one.
244
+ PermissionActions["RECONCILE_SETTLEMENT_BATCH"] = "reconcile:settlement-batch";
245
+ // The cross-country operations dashboards (revenue, providers, renewals,
246
+ // configuration readiness). PLATFORM: they aggregate every organization.
247
+ PermissionActions["READ_BILLING_OPERATIONS"] = "read:billing-operations";
248
+ // Premium trials. PLATFORM for now: trial policy is platform configuration,
249
+ // and clarion-billing does not scope a trial to the caller's organization -
250
+ // a grant names any user on the platform.
251
+ PermissionActions["READ_PREMIUM_TRIAL"] = "read:premium-trial";
252
+ PermissionActions["GRANT_PREMIUM_TRIAL"] = "grant:premium-trial";
253
+ PermissionActions["REVOKE_PREMIUM_TRIAL"] = "revoke:premium-trial";
212
254
  // Module: Newsfeed
213
255
  PermissionActions["CREATE_NEWSFEED_POST"] = "create:newsfeed-post";
214
256
  PermissionActions["READ_NEWSFEED_POST"] = "read:newsfeed-post";
@@ -224,28 +266,113 @@ export var PermissionActions;
224
266
  // CUSTOMERS see - a wrong logo or sender goes out on every OTP and alert -
225
267
  // and that is not something everyone who may edit the organization's address
226
268
  // should be able to change.
227
- PermissionActions["READ_NOTIFICATION_SETTINGS"] = "read:notification-settings";
228
- PermissionActions["MANAGE_NOTIFICATION_SETTINGS"] = "manage:notification-settings";
269
+ //
270
+ // One family per thing configured, because they are different decisions: the
271
+ // brand is marketing's, a sending address needs a verified domain, and an SMS
272
+ // sender ID is registered with each telco. clarion-notification additionally
273
+ // refuses a change from anyone not scoped to the whole organization.
274
+ //
275
+ // Branding: logo, colours, names and contact details on every email. UPDATE
276
+ // also covers the test email that shows the result.
277
+ PermissionActions["READ_NOTIFICATION_BRANDING"] = "read:notification-branding";
278
+ PermissionActions["UPDATE_NOTIFICATION_BRANDING"] = "update:notification-branding";
279
+ // The addresses the organization's email is sent from. UPDATE also covers
280
+ // re-checking an address with the email providers.
281
+ PermissionActions["CREATE_NOTIFICATION_EMAIL_SENDER"] = "create:notification-email-sender";
282
+ PermissionActions["READ_NOTIFICATION_EMAIL_SENDER"] = "read:notification-email-sender";
283
+ PermissionActions["UPDATE_NOTIFICATION_EMAIL_SENDER"] = "update:notification-email-sender";
284
+ PermissionActions["DELETE_NOTIFICATION_EMAIL_SENDER"] = "delete:notification-email-sender";
285
+ // The sender IDs its SMS arrive under. CREATE is a REQUEST: a new sender is
286
+ // pending until a platform operator approves it (below). READ also covers the
287
+ // catalogue of SMS providers a sender can be registered with.
288
+ PermissionActions["CREATE_NOTIFICATION_SMS_SENDER"] = "create:notification-sms-sender";
289
+ PermissionActions["READ_NOTIFICATION_SMS_SENDER"] = "read:notification-sms-sender";
290
+ PermissionActions["UPDATE_NOTIFICATION_SMS_SENDER"] = "update:notification-sms-sender";
291
+ PermissionActions["DELETE_NOTIFICATION_SMS_SENDER"] = "delete:notification-sms-sender";
229
292
  // Confirming that an SMS sender ID really is registered with the provider.
230
293
  // Deliberately granted to NO role: only a platform operator (Super-Admin,
231
294
  // '*') can know that, and an organization able to activate its own sender
232
295
  // could send SMS under any name it cared to type.
233
296
  PermissionActions["APPROVE_NOTIFICATION_SENDER"] = "approve:notification-sender";
297
+ /**
298
+ * @deprecated Split into the branding / email sender / SMS sender actions
299
+ * above, which the gateway now requires instead. Still granted to
300
+ * Organization:Owner and Organization:Admin for ONE release, so a gateway that
301
+ * has not yet been redeployed keeps working while clarion-authentication
302
+ * reseeds roles; remove it (and its grants) once every gateway requires the new
303
+ * actions. Grant it to nothing new.
304
+ */
305
+ PermissionActions["READ_NOTIFICATION_SETTINGS"] = "read:notification-settings";
306
+ /** @deprecated See READ_NOTIFICATION_SETTINGS. */
307
+ PermissionActions["MANAGE_NOTIFICATION_SETTINGS"] = "manage:notification-settings";
234
308
  // Module: Alert Intake
235
309
  // The channels the PUBLIC reaches an organization on without the app - its SMS
236
310
  // short code, WhatsApp number and mailbox (clarion-alerts). A family of its own
237
311
  // because a connection holds provider credentials and decides which organization
238
312
  // an emergency message is raised for; neither belongs with "may edit the
239
313
  // organization's address".
240
- PermissionActions["READ_ALERT_INTAKE"] = "read:alert-intake";
241
- PermissionActions["MANAGE_ALERT_INTAKE"] = "manage:alert-intake";
314
+ //
315
+ // Split by what the work is: CONFIGURING the channels is an organization-level
316
+ // job (clarion-alerts refuses it to anyone not scoped to the whole
317
+ // organization); WORKING what arrives on them - reading messages, raising the
318
+ // ones the pipeline could not - is a control-room job as well.
319
+ //
320
+ // A connection: the organization's own short code, WhatsApp number or mailbox,
321
+ // with its provider credentials. READ also covers the provider catalogue and
322
+ // the platform addresses the organization falls back to. UPDATE also covers
323
+ // enabling, disabling and issuing a new webhook URL (the old one stops working).
324
+ PermissionActions["CREATE_ALERT_INTAKE_CONNECTION"] = "create:alert-intake-connection";
325
+ PermissionActions["READ_ALERT_INTAKE_CONNECTION"] = "read:alert-intake-connection";
326
+ PermissionActions["UPDATE_ALERT_INTAKE_CONNECTION"] = "update:alert-intake-connection";
327
+ PermissionActions["DELETE_ALERT_INTAKE_CONNECTION"] = "delete:alert-intake-connection";
328
+ // Checking a connection against its provider with the stored credentials.
329
+ // Changes nothing, but it does sign in to the provider on the organization's
330
+ // behalf, so it is not a plain read.
331
+ PermissionActions["TEST_ALERT_INTAKE_CONNECTION"] = "test:alert-intake-connection";
332
+ // What arrived and what became of it - including what a member of the public
333
+ // wrote and the number they wrote from.
334
+ PermissionActions["READ_ALERT_INTAKE_MESSAGE"] = "read:alert-intake-message";
335
+ // Re-queueing a parked message, or raising one taken for a duplicate anyway.
336
+ // Either way it RAISES AN INCIDENT, so whoever holds this also holds
337
+ // create:incident (pinned in roles.spec.ts).
338
+ PermissionActions["RETRY_ALERT_INTAKE_MESSAGE"] = "retry:alert-intake-message";
339
+ // The review queue: messages screened out as not a report.
340
+ PermissionActions["READ_ALERT_INTAKE_SCREENED_MESSAGE"] = "read:alert-intake-screened-message";
341
+ // Raising a screened message after all (it becomes an incident) or confirming
342
+ // it is not a report. Holders also hold create:incident, as above.
343
+ PermissionActions["REVIEW_ALERT_INTAKE_SCREENED_MESSAGE"] = "review:alert-intake-screened-message";
344
+ // Volumes, outcomes, screening, timing and the AI's cost over a period. Counts
345
+ // only; kept apart from the messages because it includes what the AI costs.
346
+ PermissionActions["READ_ALERT_INTAKE_ANALYTICS"] = "read:alert-intake-analytics";
242
347
  // PLATFORM connections and their routes: the shared short code every
243
348
  // organization without its own falls back to, and which keyword sends a message
244
349
  // to which organization. Deliberately granted to NO role - one wrong route sends
245
350
  // one organization's emergencies to another. Super-Admin ('*') only. It also
246
351
  // covers the two things an organization must not be able to do to itself:
247
352
  // point a connection at a provisioned secret by name, and switch off TLS
248
- // verification on a mailbox.
353
+ // verification on a mailbox - and every organization's messages and analytics.
249
354
  PermissionActions["MANAGE_ALERT_INTAKE_PLATFORM"] = "manage:alert-intake-platform";
355
+ /**
356
+ * @deprecated Split into the connection / message / screened-message /
357
+ * analytics actions above, which the gateway now requires instead. Still
358
+ * granted to Organization:Owner and Organization:Admin for ONE release, so a
359
+ * gateway that has not yet been redeployed keeps working while
360
+ * clarion-authentication reseeds roles; remove it (and its grants) once every
361
+ * gateway requires the new actions. Grant it to nothing new.
362
+ */
363
+ PermissionActions["READ_ALERT_INTAKE"] = "read:alert-intake";
364
+ /** @deprecated See READ_ALERT_INTAKE. */
365
+ PermissionActions["MANAGE_ALERT_INTAKE"] = "manage:alert-intake";
250
366
  })(PermissionActions || (PermissionActions = {}));
367
+ /**
368
+ * Actions kept only so a gateway that has not been redeployed keeps working through
369
+ * a release that replaced them. Nothing new may require or be granted them; the
370
+ * next release removes them from the enum, the catalogue and every role.
371
+ */
372
+ export const RETIRING_PERMISSION_ACTIONS = [
373
+ PermissionActions.READ_NOTIFICATION_SETTINGS,
374
+ PermissionActions.MANAGE_NOTIFICATION_SETTINGS,
375
+ PermissionActions.READ_ALERT_INTAKE,
376
+ PermissionActions.MANAGE_ALERT_INTAKE,
377
+ ];
251
378
  //# sourceMappingURL=permission-actions.enum.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"permission-actions.enum.js","sourceRoot":"","sources":["../../../../../src/modules/permission/enums/permission-actions.enum.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,iBAoRX;AApRD,WAAY,iBAAiB;IACzB,uBAAuB;IACvB,gEAA2C,CAAA;IAC3C,4DAAuC,CAAA;IACvC,gEAA2C,CAAA;IAC3C,gEAA2C,CAAA;IAE3C,kBAAkB;IAClB,iEAAiE;IACjE,2EAA2E;IAC3E,sDAAsD;IACtD,sDAAiC,CAAA;IACjC,kDAA6B,CAAA;IAC7B,sDAAiC,CAAA;IACjC,sDAAiC,CAAA;IACjC,qEAAqE;IACrE,0EAA0E;IAC1E,+DAA+D;IAC/D,oEAA+C,CAAA;IAC/C,0EAAqD,CAAA;IACrD,0EAA0E;IAC1E,2EAA2E;IAC3E,yEAAyE;IACzE,4BAA4B;IAC5B,wEAAmD,CAAA;IACnD,wEAAmD,CAAA;IACnD,wEAAmD,CAAA;IACnD,4EAA4E;IAC5E,oEAAoE;IACpE,4EAA4E;IAC5E,0EAA0E;IAC1E,2BAA2B;IAC3B,wEAAmD,CAAA;IACnD,4EAAuD,CAAA;IAEvD,2EAA2E;IAC3E,qEAAqE;IACrE,wEAAwE;IACxE,EAAE;IACF,0EAA0E;IAC1E,kEAAkE;IAClE,uEAAuE;IACvE,0EAA0E;IAC1E,8DAA8D;IAC9D,oEAA+C,CAAA;IAC/C,gEAA2C,CAAA;IAC3C,oEAA+C,CAAA;IAC/C,oE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AiB,QAoR5B"}
1
+ {"version":3,"file":"permission-actions.enum.js","sourceRoot":"","sources":["../../../../../src/modules/permission/enums/permission-actions.enum.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,iBA4YX;AA5YD,WAAY,iBAAiB;IACzB,uBAAuB;IACvB,gEAA2C,CAAA;IAC3C,4DAAuC,CAAA;IACvC,gEAA2C,CAAA;IAC3C,gEAA2C,CAAA;IAE3C,kBAAkB;IAClB,iEAAiE;IACjE,2EAA2E;IAC3E,sDAAsD;IACtD,sDAAiC,CAAA;IACjC,kDAA6B,CAAA;IAC7B,sDAAiC,CAAA;IACjC,sDAAiC,CAAA;IACjC,qEAAqE;IACrE,0EAA0E;IAC1E,+DAA+D;IAC/D,oEAA+C,CAAA;IAC/C,0EAAqD,CAAA;IACrD,0EAA0E;IAC1E,2EAA2E;IAC3E,yEAAyE;IACzE,4BAA4B;IAC5B,wEAAmD,CAAA;IACnD,wEAAmD,CAAA;IACnD,wEAAmD,CAAA;IACnD,4EAA4E;IAC5E,oEAAoE;IACpE,4EAA4E;IAC5E,0EAA0E;IAC1E,2BAA2B;IAC3B,wEAAmD,CAAA;IACnD,4EAAuD,CAAA;IAEvD,2EAA2E;IAC3E,qEAAqE;IACrE,wEAAwE;IACxE,EAAE;IACF,0EAA0E;IAC1E,kEAAkE;IAClE,uEAAuE;IACvE,0EAA0E;IAC1E,8DAA8D;IAC9D,oEAA+C,CAAA;IAC/C,gEAA2C,CAAA;IAC3C,oEAA+C,CAAA;IAC/C,oEAA+C,CAAA;IAC/C,kEAA6C,CAAA;IAC7C,2EAA2E;IAC3E,wEAAwE;IACxE,uDAAuD;IACvD,gEAA2C,CAAA;IAC3C,kFAA6D,CAAA;IAC7D,sFAAiE,CAAA;IACjE,kEAA6C,CAAA;IAC7C,oEAA+C,CAAA;IAC/C,yEAAyE;IACzE,gEAA2C,CAAA;IAC3C;;;;OAIG;IACH,8DAAyC,CAAA;IAEzC,uEAAuE;IACvE,2EAA2E;IAC3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AyE;IACzE,+EAA+E;IAC/E,kFAA6D,CAAA;IAC7D;;;;;;;OAOG;IACH,4DAAuC,CAAA;IACvC,yCAAyC;IACzC,gEAA2C,CAAA;AAC/C,CAAC,EA5YW,iBAAiB,KAAjB,iBAAiB,QA4Y5B;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAsB;IAC1D,iBAAiB,CAAC,0BAA0B;IAC5C,iBAAiB,CAAC,4BAA4B;IAC9C,iBAAiB,CAAC,iBAAiB;IACnC,iBAAiB,CAAC,mBAAmB;CACxC,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { Roles } from "../enums/role.enum";
2
+ /**
3
+ * The organization roles that RUN an organization's billing, holding every
4
+ * organization-level billing action (see roles.data.ts).
5
+ *
6
+ * For the places that still decide by role NAME rather than permission:
7
+ * clarion-billing's checks on manual approval, marking an invoice paid and
8
+ * renewing on a subscriber's behalf, and the admin's billing screens deciding
9
+ * whether to offer an action at all. roles.spec.ts asserts every role listed
10
+ * here holds the full organization billing set, so the names and the grants
11
+ * cannot drift apart.
12
+ */
13
+ export const BILLING_MANAGER_ROLES = [
14
+ Roles.ORGANIZATION_OWNER,
15
+ Roles.ORGANIZATION_ADMIN,
16
+ Roles.ORGANIZATION_BILLING_ADMIN
17
+ ];
18
+ /**
19
+ * The organization roles that may SEE its billing: the managers, plus
20
+ * Organization:User, which holds the reads and nothing else.
21
+ */
22
+ export const BILLING_VIEWER_ROLES = [
23
+ ...BILLING_MANAGER_ROLES,
24
+ Roles.ORGANIZATION_USER
25
+ ];
26
+ //# sourceMappingURL=billing-roles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing-roles.js","sourceRoot":"","sources":["../../../../../src/modules/role/constants/billing-roles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAa;IAC3C,KAAK,CAAC,kBAAkB;IACxB,KAAK,CAAC,kBAAkB;IACxB,KAAK,CAAC,0BAA0B;CACnC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAa;IAC1C,GAAG,qBAAqB;IACxB,KAAK,CAAC,iBAAiB;CAC1B,CAAC"}
@@ -7,7 +7,8 @@ export const ORGANIZATION_ROLES = [
7
7
  Roles.ORGANIZATION_NEWSFEED_ADMIN,
8
8
  Roles.ORGANIZATION_PARTNERSHIPS_ADMIN,
9
9
  Roles.ORGANIZATION_RESPONSE_UNITS_ADMIN,
10
- Roles.ORGANIZATION_SUPPORT_ADMIN
10
+ Roles.ORGANIZATION_SUPPORT_ADMIN,
11
+ Roles.ORGANIZATION_ALERT_CHANNELS_ADMIN
11
12
  ];
12
13
  export const CONTROL_CENTRE_ROLES = [
13
14
  Roles.CONTROL_CENTRE_ADMIN,
@@ -1 +1 @@
1
- {"version":3,"file":"roles-by-scope.js","sourceRoot":"","sources":["../../../../../src/modules/role/constants/roles-by-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,MAAM,CAAC,MAAM,kBAAkB,GAAa;IACxC,KAAK,CAAC,kBAAkB;IACxB,KAAK,CAAC,kBAAkB;IACxB,KAAK,CAAC,iBAAiB;IACvB,KAAK,CAAC,0BAA0B;IAChC,KAAK,CAAC,2BAA2B;IACjC,KAAK,CAAC,+BAA+B;IACrC,KAAK,CAAC,iCAAiC;IACvC,KAAK,CAAC,0BAA0B;CACnC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAa;IAC1C,KAAK,CAAC,oBAAoB;IAC1B,KAAK,CAAC,mBAAmB;IACzB,KAAK,CAAC,SAAS;IACf,KAAK,CAAC,mCAAmC;CAC5C,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAa;IAClC,KAAK,CAAC,WAAW;CACpB,CAAC"}
1
+ {"version":3,"file":"roles-by-scope.js","sourceRoot":"","sources":["../../../../../src/modules/role/constants/roles-by-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,MAAM,CAAC,MAAM,kBAAkB,GAAa;IACxC,KAAK,CAAC,kBAAkB;IACxB,KAAK,CAAC,kBAAkB;IACxB,KAAK,CAAC,iBAAiB;IACvB,KAAK,CAAC,0BAA0B;IAChC,KAAK,CAAC,2BAA2B;IACjC,KAAK,CAAC,+BAA+B;IACrC,KAAK,CAAC,iCAAiC;IACvC,KAAK,CAAC,0BAA0B;IAChC,KAAK,CAAC,iCAAiC;CAC1C,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAa;IAC1C,KAAK,CAAC,oBAAoB;IAC1B,KAAK,CAAC,mBAAmB;IACzB,KAAK,CAAC,SAAS;IACf,KAAK,CAAC,mCAAmC;CAC5C,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAa;IAClC,KAAK,CAAC,WAAW;CACpB,CAAC"}
@@ -88,6 +88,210 @@ const RESPONSE_UNITS_ADMIN_PERMISSIONS = [
88
88
  //its country, which centres their map and scopes the address search.
89
89
  PermissionActions.READ_ORGANIZATION
90
90
  ];
91
+ /**
92
+ * Every Alert Intake action an organization may hold: the whole module apart from
93
+ * the platform action (Super-Admin only) and the two retiring ones. Configuring
94
+ * the channels and working what arrives on them.
95
+ */
96
+ const ALERT_INTAKE_ORGANIZATION_PERMISSIONS = [
97
+ //Configuring the channels. clarion-alerts additionally refuses these to anyone
98
+ //not scoped to the whole organization.
99
+ PermissionActions.CREATE_ALERT_INTAKE_CONNECTION,
100
+ PermissionActions.READ_ALERT_INTAKE_CONNECTION,
101
+ PermissionActions.UPDATE_ALERT_INTAKE_CONNECTION,
102
+ PermissionActions.DELETE_ALERT_INTAKE_CONNECTION,
103
+ PermissionActions.TEST_ALERT_INTAKE_CONNECTION,
104
+ //Working what arrives on them.
105
+ PermissionActions.READ_ALERT_INTAKE_MESSAGE,
106
+ PermissionActions.RETRY_ALERT_INTAKE_MESSAGE,
107
+ PermissionActions.READ_ALERT_INTAKE_SCREENED_MESSAGE,
108
+ PermissionActions.REVIEW_ALERT_INTAKE_SCREENED_MESSAGE,
109
+ PermissionActions.READ_ALERT_INTAKE_ANALYTICS
110
+ ];
111
+ /**
112
+ * The control room's share of the channels: see how they are set up and what
113
+ * arrived, and raise what the pipeline could not - a parked message, one taken
114
+ * for a duplicate, one screened out that is a report after all. Not the channels'
115
+ * configuration, which is the organization's.
116
+ */
117
+ const ALERT_INTAKE_OPERATOR_PERMISSIONS = [
118
+ PermissionActions.READ_ALERT_INTAKE_CONNECTION,
119
+ PermissionActions.READ_ALERT_INTAKE_MESSAGE,
120
+ PermissionActions.RETRY_ALERT_INTAKE_MESSAGE,
121
+ PermissionActions.READ_ALERT_INTAKE_SCREENED_MESSAGE,
122
+ PermissionActions.REVIEW_ALERT_INTAKE_SCREENED_MESSAGE,
123
+ PermissionActions.READ_ALERT_INTAKE_ANALYTICS
124
+ ];
125
+ /** Sees all of it, changes none of it. */
126
+ const ALERT_INTAKE_READ_PERMISSIONS = [
127
+ PermissionActions.READ_ALERT_INTAKE_CONNECTION,
128
+ PermissionActions.READ_ALERT_INTAKE_MESSAGE,
129
+ PermissionActions.READ_ALERT_INTAKE_SCREENED_MESSAGE,
130
+ PermissionActions.READ_ALERT_INTAKE_ANALYTICS
131
+ ];
132
+ /**
133
+ * What an Alert-Channels-Admin may do: the organization's alert intake in full,
134
+ * and exactly what that work needs from other modules. Pinned by roles.spec.ts.
135
+ */
136
+ const ALERT_CHANNELS_ADMIN_PERMISSIONS = [
137
+ ...ALERT_INTAKE_ORGANIZATION_PERMISSIONS,
138
+ //--- outside the Alert Intake module --------------------------------
139
+ //Incident: retrying a message and raising a screened one after all both
140
+ //RAISE AN INCIDENT. The pipeline files it, but the decision is this role's,
141
+ //and whoever may raise an incident from a message may raise one at all.
142
+ PermissionActions.CREATE_INCIDENT,
143
+ //...and see what it raised. Messages and the review queue name the incident
144
+ //each became; the analysis files it under the organization's own categories
145
+ //and types, which the incident screens show.
146
+ PermissionActions.READ_INCIDENT,
147
+ PermissionActions.READ_INCIDENT_CATEGORY_TYPE,
148
+ //Context, read-only: the organization the channels belong to, and the control
149
+ //centres the incidents they raise are worked in.
150
+ PermissionActions.READ_ORGANIZATION,
151
+ PermissionActions.READ_CONTROL_CENTRE
152
+ ];
153
+ /** Branding, email senders and SMS senders in full - apart from approving a sender. */
154
+ const NOTIFICATION_SETTINGS_PERMISSIONS = [
155
+ PermissionActions.READ_NOTIFICATION_BRANDING,
156
+ PermissionActions.UPDATE_NOTIFICATION_BRANDING,
157
+ PermissionActions.CREATE_NOTIFICATION_EMAIL_SENDER,
158
+ PermissionActions.READ_NOTIFICATION_EMAIL_SENDER,
159
+ PermissionActions.UPDATE_NOTIFICATION_EMAIL_SENDER,
160
+ PermissionActions.DELETE_NOTIFICATION_EMAIL_SENDER,
161
+ PermissionActions.CREATE_NOTIFICATION_SMS_SENDER,
162
+ PermissionActions.READ_NOTIFICATION_SMS_SENDER,
163
+ PermissionActions.UPDATE_NOTIFICATION_SMS_SENDER,
164
+ PermissionActions.DELETE_NOTIFICATION_SMS_SENDER
165
+ ];
166
+ const NOTIFICATION_SETTINGS_READ_PERMISSIONS = [
167
+ PermissionActions.READ_NOTIFICATION_BRANDING,
168
+ PermissionActions.READ_NOTIFICATION_EMAIL_SENDER,
169
+ PermissionActions.READ_NOTIFICATION_SMS_SENDER
170
+ ];
171
+ /**
172
+ * Running an organization's own billing: every ORGANIZATION-level action in the
173
+ * Billing module (see the enum). clarion-billing scopes all of these to the
174
+ * caller's organization. Held in full by the roles in BILLING_MANAGER_ROLES.
175
+ *
176
+ * The Billing module's other actions are PLATFORM-level and held by no role -
177
+ * roles.spec.ts names them, and fails on any billing action that is in neither
178
+ * list:
179
+ * - billing config create/update/delete: the commercial terms (revenue share,
180
+ * tax treatment) the platform sets each organization. An organization must
181
+ * not set its own commission.
182
+ * - settlement create/send-invoice/mark-paid: the platform settling revenue
183
+ * share with an organization. clarion-billing does not scope these.
184
+ * - settlement batches and billing operations: provider payouts and the
185
+ * cross-organization dashboards.
186
+ * - premium trials and read:entitlement: clarion-billing names any user on
187
+ * the platform on these routes, with no organization check. Grant them to
188
+ * an organization role only once it does.
189
+ */
190
+ const BILLING_ORGANIZATION_PERMISSIONS = [
191
+ //Packages: what the organization sells, and whether it is on sale.
192
+ PermissionActions.CREATE_PACKAGE,
193
+ PermissionActions.READ_PACKAGE,
194
+ PermissionActions.UPDATE_PACKAGE,
195
+ PermissionActions.ACTIVATE_PACKAGE,
196
+ PermissionActions.DEACTIVATE_PACKAGE,
197
+ PermissionActions.DELETE_PACKAGE,
198
+ //Clients: individuals, companies, a company's members, and the dependants
199
+ //on anybody's plan. UPDATE_BENEFICIARY, UPDATE_CORPORATE_CLIENT_MEMBER and
200
+ //DELETE_INDIVIDUAL_CLIENT have no route yet; they sit with the rest of
201
+ //their record so a route added later needs no new grant.
202
+ PermissionActions.CREATE_INDIVIDUAL_CLIENT,
203
+ PermissionActions.READ_INDIVIDUAL_CLIENT,
204
+ PermissionActions.UPDATE_INDIVIDUAL_CLIENT,
205
+ PermissionActions.DELETE_INDIVIDUAL_CLIENT,
206
+ PermissionActions.CREATE_CORPORATE_CLIENT,
207
+ PermissionActions.READ_CORPORATE_CLIENT,
208
+ PermissionActions.UPDATE_CORPORATE_CLIENT,
209
+ PermissionActions.DELETE_CORPORATE_CLIENT,
210
+ PermissionActions.CREATE_CORPORATE_CLIENT_MEMBER,
211
+ PermissionActions.READ_CORPORATE_CLIENT_MEMBER,
212
+ PermissionActions.UPDATE_CORPORATE_CLIENT_MEMBER,
213
+ PermissionActions.DELETE_CORPORATE_CLIENT_MEMBER,
214
+ PermissionActions.CREATE_BENEFICIARY,
215
+ PermissionActions.READ_BENEFICIARY,
216
+ PermissionActions.UPDATE_BENEFICIARY,
217
+ PermissionActions.DELETE_BENEFICIARY,
218
+ //Subscriptions, including approving one without payment and cancelling -
219
+ //clarion-billing additionally confines both to the organization's own.
220
+ PermissionActions.INITIALIZE_INDIVIDUAL_SUBSCRIPTION,
221
+ PermissionActions.READ_INDIVIDUAL_SUBSCRIPTION,
222
+ PermissionActions.APPROVE_INDIVIDUAL_SUBSCRIPTION_MANUALLY,
223
+ PermissionActions.CANCEL_INDIVIDUAL_SUBSCRIPTION,
224
+ PermissionActions.INITIALIZE_CORPORATE_SUBSCRIPTION,
225
+ PermissionActions.READ_CORPORATE_SUBSCRIPTION,
226
+ PermissionActions.APPROVE_CORPORATE_SUBSCRIPTION_MANUALLY,
227
+ PermissionActions.CANCEL_CORPORATE_SUBSCRIPTION,
228
+ PermissionActions.RENEW_SUBSCRIPTION,
229
+ //Corporate orders, and the documents the money produces. CREATE_INVOICE and
230
+ //CREATE_RECEIPT have no route yet: both are issued by the system on payment.
231
+ PermissionActions.CREATE_ORDER,
232
+ PermissionActions.READ_ORDER,
233
+ PermissionActions.CONFIRM_ORDER,
234
+ PermissionActions.CREATE_INVOICE,
235
+ PermissionActions.READ_INVOICE,
236
+ PermissionActions.MARK_INVOICE_PAID,
237
+ PermissionActions.CREATE_RECEIPT,
238
+ PermissionActions.READ_RECEIPT,
239
+ //Payments: starting a checkout, re-checking one with the provider, and the
240
+ //transaction list.
241
+ PermissionActions.INITIALIZE_PAYMENT,
242
+ PermissionActions.VERIFY_PAYMENT,
243
+ PermissionActions.READ_PAYMENT,
244
+ //What the platform settles with the organization and the terms it bills
245
+ //under - SEEN, not set: changing either is the platform's (see above).
246
+ PermissionActions.READ_SETTLEMENT,
247
+ PermissionActions.READ_BILLING_CONFIG
248
+ ];
249
+ /** Sees the organization's billing, changes none of it. */
250
+ const BILLING_READ_PERMISSIONS = BILLING_ORGANIZATION_PERMISSIONS.filter((action) => action.startsWith('read:'));
251
+ /**
252
+ * What an Organization:Billing-Admin may do: the organization's billing in full,
253
+ * and exactly what that work needs from other modules. Pinned by roles.spec.ts.
254
+ */
255
+ const BILLING_ADMIN_PERMISSIONS = [
256
+ ...BILLING_ORGANIZATION_PERMISSIONS,
257
+ //--- outside the Billing module -------------------------------------
258
+ //read:user is REQUIRED, not convenience: an individual client is a platform
259
+ //user, and billing stores only the id - the client list and detail pages
260
+ //fetch the name, phone and email from the user directory.
261
+ PermissionActions.READ_USER,
262
+ //A package covers a set of incident types, and the package form lists them
263
+ //to choose from. The taxonomy only - not the incidents themselves.
264
+ PermissionActions.READ_INCIDENT_CATEGORY_TYPE,
265
+ //Context: the organization the billing belongs to.
266
+ PermissionActions.READ_ORGANIZATION
267
+ //No partner permission. Billing reaches clarion-partner-services
268
+ //service-to-service (the date-of-birth lock asks it whether a partner holds a
269
+ //person), which needs no permission of the operator's; and no billing screen
270
+ //calls a partner route. Registering members is Partnerships-Admin's job.
271
+ ];
272
+ /**
273
+ * A subscriber's own billing, from the app: browse the packages, buy one, renew
274
+ * it, and confirm the payment. Everything else they see of their own plan comes
275
+ * from the self-scoped "me" routes, which need no permission. clarion-billing
276
+ * checks the caller owns what they act on.
277
+ */
278
+ const BILLING_SUBSCRIBER_PERMISSIONS = [
279
+ PermissionActions.READ_PACKAGE,
280
+ PermissionActions.INITIALIZE_INDIVIDUAL_SUBSCRIPTION,
281
+ PermissionActions.RENEW_SUBSCRIPTION,
282
+ PermissionActions.VERIFY_PAYMENT
283
+ ];
284
+ /**
285
+ * The broad actions this release replaced, still held by the two roles that held
286
+ * them so a gateway that has not been redeployed keeps answering while
287
+ * clarion-authentication reseeds. Removed next release (RETIRING_PERMISSION_ACTIONS).
288
+ */
289
+ const RETIRING_ORGANIZATION_ADMIN_PERMISSIONS = [
290
+ PermissionActions.READ_NOTIFICATION_SETTINGS,
291
+ PermissionActions.MANAGE_NOTIFICATION_SETTINGS,
292
+ PermissionActions.READ_ALERT_INTAKE,
293
+ PermissionActions.MANAGE_ALERT_INTAKE
294
+ ];
91
295
  export const ROLES_DATA = [
92
296
  {
93
297
  name: Roles.SUPER_ADMIN,
@@ -102,14 +306,15 @@ export const ROLES_DATA = [
102
306
  PermissionActions.READ_ORGANIZATION,
103
307
  PermissionActions.UPDATE_ORGANIZATION,
104
308
  PermissionActions.DELETE_ORGANIZATION,
105
- //Notification settings: branding, email sender and SMS sender IDs.
309
+ //Notification settings: branding, email senders and SMS sender IDs.
106
310
  //APPROVE_NOTIFICATION_SENDER is withheld on purpose - see the enum.
107
- PermissionActions.READ_NOTIFICATION_SETTINGS,
108
- PermissionActions.MANAGE_NOTIFICATION_SETTINGS,
109
- //Alert intake: the organization's own SMS, WhatsApp and email channels.
110
- //MANAGE_ALERT_INTAKE_PLATFORM is withheld on purpose - see the enum.
111
- PermissionActions.READ_ALERT_INTAKE,
112
- PermissionActions.MANAGE_ALERT_INTAKE,
311
+ ...NOTIFICATION_SETTINGS_PERMISSIONS,
312
+ //Alert intake: the organization's own SMS, WhatsApp and email channels,
313
+ //and what arrives on them. MANAGE_ALERT_INTAKE_PLATFORM is withheld on
314
+ //purpose - see the enum.
315
+ ...ALERT_INTAKE_ORGANIZATION_PERMISSIONS,
316
+ //Retiring next release - see RETIRING_ORGANIZATION_ADMIN_PERMISSIONS.
317
+ ...RETIRING_ORGANIZATION_ADMIN_PERMISSIONS,
113
318
  //Partner
114
319
  PermissionActions.CREATE_PARTNER,
115
320
  PermissionActions.READ_PARTNER,
@@ -197,7 +402,10 @@ export const ROLES_DATA = [
197
402
  PermissionActions.READ_TRACKING_POSITION,
198
403
  PermissionActions.READ_TRACKING_HISTORY,
199
404
  PermissionActions.READ_TRACKING_OPERATIONS,
200
- PermissionActions.MANAGE_TRACKING_OPERATIONS
405
+ PermissionActions.MANAGE_TRACKING_OPERATIONS,
406
+ //Billing: the organization's own, in full. The platform-level billing
407
+ //actions are withheld on purpose - see BILLING_ORGANIZATION_PERMISSIONS.
408
+ ...BILLING_ORGANIZATION_PERMISSIONS
201
409
  ]
202
410
  },
203
411
  {
@@ -207,14 +415,15 @@ export const ROLES_DATA = [
207
415
  //organization
208
416
  PermissionActions.READ_ORGANIZATION,
209
417
  PermissionActions.UPDATE_ORGANIZATION,
210
- //Notification settings: branding, email sender and SMS sender IDs.
418
+ //Notification settings: branding, email senders and SMS sender IDs.
211
419
  //APPROVE_NOTIFICATION_SENDER is withheld on purpose - see the enum.
212
- PermissionActions.READ_NOTIFICATION_SETTINGS,
213
- PermissionActions.MANAGE_NOTIFICATION_SETTINGS,
214
- //Alert intake: the organization's own SMS, WhatsApp and email channels.
215
- //MANAGE_ALERT_INTAKE_PLATFORM is withheld on purpose - see the enum.
216
- PermissionActions.READ_ALERT_INTAKE,
217
- PermissionActions.MANAGE_ALERT_INTAKE,
420
+ ...NOTIFICATION_SETTINGS_PERMISSIONS,
421
+ //Alert intake: the organization's own SMS, WhatsApp and email channels,
422
+ //and what arrives on them. MANAGE_ALERT_INTAKE_PLATFORM is withheld on
423
+ //purpose - see the enum.
424
+ ...ALERT_INTAKE_ORGANIZATION_PERMISSIONS,
425
+ //Retiring next release - see RETIRING_ORGANIZATION_ADMIN_PERMISSIONS.
426
+ ...RETIRING_ORGANIZATION_ADMIN_PERMISSIONS,
218
427
  //Partner
219
428
  PermissionActions.CREATE_PARTNER,
220
429
  PermissionActions.READ_PARTNER,
@@ -302,7 +511,9 @@ export const ROLES_DATA = [
302
511
  PermissionActions.READ_TRACKING_POSITION,
303
512
  PermissionActions.READ_TRACKING_HISTORY,
304
513
  PermissionActions.READ_TRACKING_OPERATIONS,
305
- PermissionActions.MANAGE_TRACKING_OPERATIONS
514
+ PermissionActions.MANAGE_TRACKING_OPERATIONS,
515
+ //Billing: the organization's own, in full, as for the Owner.
516
+ ...BILLING_ORGANIZATION_PERMISSIONS
306
517
  ]
307
518
  },
308
519
  {
@@ -340,7 +551,16 @@ export const ROLES_DATA = [
340
551
  PermissionActions.READ_TRACKING_DEVICE_BINDING,
341
552
  PermissionActions.READ_TRACKING_POSITION,
342
553
  PermissionActions.READ_TRACKING_HISTORY,
343
- PermissionActions.READ_TRACKING_OPERATIONS
554
+ PermissionActions.READ_TRACKING_OPERATIONS,
555
+ //Notification settings: sees how the organization's email and SMS
556
+ //present it, changes none of it.
557
+ ...NOTIFICATION_SETTINGS_READ_PERMISSIONS,
558
+ //Alert intake: sees the channels, what arrived and the analytics;
559
+ //raises and configures nothing.
560
+ ...ALERT_INTAKE_READ_PERMISSIONS,
561
+ //Billing: sees the organization's packages, clients, subscriptions and
562
+ //money; changes none of it.
563
+ ...BILLING_READ_PERMISSIONS
344
564
  ]
345
565
  },
346
566
  {
@@ -373,6 +593,11 @@ export const ROLES_DATA = [
373
593
  PermissionActions.READ_INCIDENT_CATEGORY_TYPE
374
594
  ]
375
595
  },
596
+ {
597
+ name: Roles.ORGANIZATION_BILLING_ADMIN,
598
+ description: 'Organization Billing Admin: Manage the organization\'s billing - packages, individual and corporate clients, subscriptions, orders, invoices, receipts and payments',
599
+ permissions: [...BILLING_ADMIN_PERMISSIONS]
600
+ },
376
601
  {
377
602
  name: Roles.ORGANIZATION_SUPPORT_ADMIN,
378
603
  description: 'Organization Support Admin: Manage support tickets, customer feedback and the support desk configuration across the organization',
@@ -383,6 +608,11 @@ export const ROLES_DATA = [
383
608
  description: 'Organization Response Units Admin: Manage response units and their tracking - provider connections, device bindings and tracking operations - across the organization',
384
609
  permissions: [...RESPONSE_UNITS_ADMIN_PERMISSIONS]
385
610
  },
611
+ {
612
+ name: Roles.ORGANIZATION_ALERT_CHANNELS_ADMIN,
613
+ description: 'Organization Alert Channels Admin: Set up and manage the SMS, WhatsApp and email channels the public reaches the organization on, and work what arrives on them',
614
+ permissions: [...ALERT_CHANNELS_ADMIN_PERMISSIONS]
615
+ },
386
616
  {
387
617
  name: Roles.CONTROL_CENTRE_ADMIN,
388
618
  description: 'Control Centre Admin: Manage Control Centre',
@@ -459,7 +689,12 @@ export const ROLES_DATA = [
459
689
  PermissionActions.READ_TRACKING_POSITION,
460
690
  PermissionActions.READ_TRACKING_HISTORY,
461
691
  PermissionActions.READ_TRACKING_OPERATIONS,
462
- PermissionActions.MANAGE_TRACKING_OPERATIONS
692
+ PermissionActions.MANAGE_TRACKING_OPERATIONS,
693
+ //Alert intake: sees how the organization's channels are set up and what
694
+ //arrived on them, and raises what the pipeline could not - retrying a
695
+ //parked message, raising a screened one after all. Configuring the
696
+ //channels stays with the organization.
697
+ ...ALERT_INTAKE_OPERATOR_PERMISSIONS
463
698
  ]
464
699
  },
465
700
  {
@@ -615,7 +850,11 @@ export const ROLES_DATA = [
615
850
  PermissionActions.RATE_SUPPORT_TICKET,
616
851
  PermissionActions.CREATE_SUPPORT_FEEDBACK,
617
852
  PermissionActions.READ_SUPPORT_FEEDBACK,
618
- PermissionActions.REPLY_SUPPORT_FEEDBACK
853
+ PermissionActions.REPLY_SUPPORT_FEEDBACK,
854
+ //Billing - the SUBSCRIBER surface only: see BILLING_SUBSCRIBER_PERMISSIONS.
855
+ //These used to ride on the incident permissions above, which also opened
856
+ //every billing management route to every handset.
857
+ ...BILLING_SUBSCRIBER_PERMISSIONS
619
858
  ]
620
859
  }
621
860
  ];