@7365admin1/layer-common 4.2.21 → 4.2.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 4.2.22
4
+
5
+ ### Patch Changes
6
+
7
+ - 4977a90: Let the console's Roles and Permissions screen list every role a super admin can hand out.
8
+
9
+ The screen passed `type="admin"` and so listed only the 2 platform-staff roles, while Client List -> Invite Client asks `GET /api/roles` with no type and is offered all 12 org-less roles. `RolePermissionMain` takes an optional `listType` that filters the LIST independently of the type a newly created role is given, and draws a Scope column when a page asks for one. No other page changes.
10
+
3
11
  ## 4.2.21
4
12
 
5
13
  ### Patch Changes
@@ -732,11 +740,11 @@
732
740
  `utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
733
741
  own rule from two endpoints the console already calls, unprojected:
734
742
 
735
- GET /api/members/user/:user/app/admin the Seven365 staff membership
736
- GET /api/roles/id/:role that membership's role document
743
+ GET /api/members/user/:user/app/admin the Seven365 staff membership
744
+ GET /api/roles/id/:role that membership's role document
737
745
 
738
- owner = member.type === "admin" && role.type === "admin" && role.default === true
739
- staff = member.type === "admin" && role.type === "admin"
746
+ owner = member.type === "admin" && role.type === "admin" && role.default === true
747
+ staff = member.type === "admin" && role.type === "admin"
740
748
 
741
749
  `role.default` is the marker because it is the only property of a platform
742
750
  staff role no API caller can set - `role.controller.ts` validates create and
@@ -52,6 +52,20 @@
52
52
  @click:row="tableRowClickHandler"
53
53
  style="max-height: calc(100vh - (180px))"
54
54
  >
55
+ <!--
56
+ SCOPE. Only rendered when a page puts `scope` in its `headers`,
57
+ which is the console's Roles and Permissions screen and nothing
58
+ else. Two kinds share that list and they are governed differently,
59
+ so the row has to say which it is.
60
+ -->
61
+ <template #item.scope="{ item }">
62
+ <StatusChip
63
+ :dot="false"
64
+ :tone="item.type === 'admin' ? 'info' : 'neutral'"
65
+ :label="scopeLabel(item)"
66
+ />
67
+ </template>
68
+
55
69
  <template #item.permissions="{ value }">
56
70
  <span class="text-caption font-weight-bold text-capitalize">
57
71
  permissions
@@ -221,6 +235,29 @@ const props = defineProps({
221
235
  required: true,
222
236
  default: "app",
223
237
  },
238
+ /*
239
+ * The `type` the LIST is filtered by, when it differs from the `type` a
240
+ * newly created role is given.
241
+ *
242
+ * They were the same value, and on the Seven365 console that was the defect:
243
+ * the screen passed `type="admin"`, so it listed the 2 platform-staff roles
244
+ * and nothing else -- while the console's own "Invite Client" picker asks
245
+ * `GET /api/roles` with no `type` and is offered all 12 ORG-LESS roles
246
+ * (10 `type: "organization"` templates + those same 2). A super admin could
247
+ * therefore hand out ten roles the Roles and Permissions screen could not
248
+ * show, edit or delete.
249
+ *
250
+ * The server has always allowed it: an org-less role of ANY type goes to
251
+ * `requireConsolePermission("roles-and-permissions")`
252
+ * (`core role.controller requireRoleOrg`), so this only stops the UI hiding
253
+ * what the console may already manage. `null` keeps every other page exactly
254
+ * as it was; `""` means "do not filter by type", which for an org-less
255
+ * caller IS the administrative scope.
256
+ */
257
+ listType: {
258
+ type: String,
259
+ default: null,
260
+ },
224
261
  permissions: {
225
262
  type: Object,
226
263
  required: true,
@@ -296,7 +333,7 @@ const {
296
333
  _getRoles({
297
334
  page: page.value,
298
335
  search: headerSearch.value,
299
- type: props.type,
336
+ type: props.listType ?? props.type,
300
337
  org: props.orgId,
301
338
  site: props.siteId,
302
339
  }),
@@ -338,6 +375,19 @@ const emptyText = computed(() => {
338
375
  return "No roles have been created yet.";
339
376
  });
340
377
 
378
+ /**
379
+ * What KIND of role a row is, in the words the console needs.
380
+ *
381
+ * A role with no `org` is not a client's -- it is either the Seven365 console's
382
+ * own staff role (`type: "admin"`) or an org-less TEMPLATE that any invitation
383
+ * may hand out. Both are managed here; only the second one leaves this system.
384
+ */
385
+ function scopeLabel(item: Record<string, any>) {
386
+ if (item?.type === "admin") return "Platform staff";
387
+ if (props.orgId) return "Organisation";
388
+ return "Client template";
389
+ }
390
+
341
391
  function tableRowClickHandler(_: any, data: any) {
342
392
  // "See role details". Ungated until now, which is why granting or withholding
343
393
  // it changed nothing.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@7365admin1/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "4.2.21",
5
+ "version": "4.2.22",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",