@7365admin1/layer-common 4.3.0 → 4.3.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/CHANGELOG.md +10 -4
- package/components/InvitationForm.vue +23 -6
- package/components/MemberMain.vue +43 -2
- package/components/RolePermissionMain.vue +29 -3
- package/composables/useRole.ts +11 -2
- package/composables/useSecurityPermission.ts +23 -0
- package/constants/permissions.ts +7 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @iservice365/layer-common
|
|
2
2
|
|
|
3
|
+
## 4.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 54579b3: Fix two permission strings that resolved to nothing for live production members: alias `work-orders:see-work-order-details` to the canonical `work_orders:` spelling (4 roles, 8 members), and offer `virtual-patrol:see-all-virtual-patrols` in the security picker, which `core` and `web-app-property-management` already enforce but no picker offered (1 role, 5 members). Catalogue and alias only — nothing is granted to anybody.
|
|
8
|
+
|
|
3
9
|
## 4.3.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -848,11 +854,11 @@
|
|
|
848
854
|
`utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
|
|
849
855
|
own rule from two endpoints the console already calls, unprojected:
|
|
850
856
|
|
|
851
|
-
|
|
852
|
-
|
|
857
|
+
GET /api/members/user/:user/app/admin the Seven365 staff membership
|
|
858
|
+
GET /api/roles/id/:role that membership's role document
|
|
853
859
|
|
|
854
|
-
|
|
855
|
-
|
|
860
|
+
owner = member.type === "admin" && role.type === "admin" && role.default === true
|
|
861
|
+
staff = member.type === "admin" && role.type === "admin"
|
|
856
862
|
|
|
857
863
|
`role.default` is the marker because it is the only property of a platform
|
|
858
864
|
staff role no API caller can set - `role.controller.ts` validates create and
|
|
@@ -365,16 +365,33 @@ watchEffect(() => {
|
|
|
365
365
|
|
|
366
366
|
const roles = ref<Array<Record<string, any>>>([]);
|
|
367
367
|
|
|
368
|
-
|
|
368
|
+
/*
|
|
369
|
+
* This asked for the organisation's own roles ONLY, so it silently withheld the
|
|
370
|
+
* ORG-LESS template roles -- and those are not an edge case: on staging 341 of
|
|
371
|
+
* the 942 role-carrying invitations name one, and `core invite-role-scope.util
|
|
372
|
+
* roleInvitable` accepts them explicitly ("a role with no `org` is a TEMPLATE
|
|
373
|
+
* role"). Onboarding's "Invite Org Admin" and "Invite Site Admin" are the two
|
|
374
|
+
* screens that mount this form, and a brand-new organisation is exactly the
|
|
375
|
+
* case with no roles of its own yet, so the picker could be empty at the one
|
|
376
|
+
* moment it matters most.
|
|
377
|
+
*
|
|
378
|
+
* `getInvitableRoles` is the union the server accepts: the organisation's own
|
|
379
|
+
* roles (still filtered by `props.app`, so nothing that is offered today stops
|
|
380
|
+
* being offered) PLUS the org-less templates, MINUS the `type: "admin"`
|
|
381
|
+
* Seven365 console roles that `roleInvitable` refuses on any non-staff
|
|
382
|
+
* invitation. Widening, except for options that could only ever be picked and
|
|
383
|
+
* then rejected.
|
|
384
|
+
*/
|
|
385
|
+
const { getInvitableRoles } = useRole();
|
|
369
386
|
|
|
370
387
|
const { data: RolesData, refresh: refreshRoles } = await useLazyAsyncData(
|
|
371
388
|
"get-roles-by-type-" + props.org + "-" + props.app,
|
|
372
389
|
() =>
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
390
|
+
getInvitableRoles({
|
|
391
|
+
org: props.org,
|
|
392
|
+
type: props.app,
|
|
393
|
+
limit: 50,
|
|
394
|
+
}),
|
|
378
395
|
{ watch: [() => props.app] }
|
|
379
396
|
);
|
|
380
397
|
|
|
@@ -471,9 +471,50 @@ function setMember({
|
|
|
471
471
|
}
|
|
472
472
|
|
|
473
473
|
const roles = ref<Array<Record<string, any>>>([]);
|
|
474
|
+
/*
|
|
475
|
+
* THE ROLES THIS SCREEN MAY ASSIGN.
|
|
476
|
+
*
|
|
477
|
+
* Two defects were fixed here together, because fixing either alone leaves the
|
|
478
|
+
* picker wrong.
|
|
479
|
+
*
|
|
480
|
+
* 1. `limit: 20`. The server caps `limit` at 100 and defaults to 10
|
|
481
|
+
* (`core role.controller.ts:320`), and this screen asked for 20 and never
|
|
482
|
+
* paged. One live organisation already has 47 active
|
|
483
|
+
* `property_management_agency` roles, so 27 of its roles could not be
|
|
484
|
+
* assigned to anybody from this screen at all -- the list simply stopped.
|
|
485
|
+
* 100 is the validated ceiling, not a guess.
|
|
486
|
+
*
|
|
487
|
+
* 2. No `site`. A role created on a site CARRIES that site, and
|
|
488
|
+
* `RolePermissionMain` was fixed to send it so the role editor stops listing
|
|
489
|
+
* other estates' roles -- but this screen, which is what actually hands a
|
|
490
|
+
* role to a person, was never given the same scope. So a site's member page
|
|
491
|
+
* offered every other site's roles for assignment.
|
|
492
|
+
*
|
|
493
|
+
* Passing `site` cannot hide an organisation-wide role: `core role.repo.ts:304`
|
|
494
|
+
* matches `{ site }` OR `{ site: "" }` OR `{ site: null }`, which covers every
|
|
495
|
+
* role created before the field existed. Measured against staging before
|
|
496
|
+
* changing anything: of 397 active memberships, 47 hold a site-pinned role and
|
|
497
|
+
* 6 hold one pinned to a DIFFERENT site than the membership. All six are test
|
|
498
|
+
* accounts, and none loses access -- `selectedRole` below is seeded from the
|
|
499
|
+
* membership itself, not from this list, so an unlisted current role still
|
|
500
|
+
* submits unchanged.
|
|
501
|
+
*
|
|
502
|
+
* `props.siteId` is empty on the organisation-level and console member screens,
|
|
503
|
+
* and an empty `site` is a no-op server-side (`if (site)`), so those are
|
|
504
|
+
* unchanged. The site is part of the cache key on purpose: without it the first
|
|
505
|
+
* site to ask would answer for the next one out of Nuxt's payload cache and the
|
|
506
|
+
* filter would be decorative -- the same trap the server's own Redis key had.
|
|
507
|
+
*/
|
|
474
508
|
const { getRoles } = useRole();
|
|
475
|
-
const { data: getAllRoleReq } = useLazyAsyncData(
|
|
476
|
-
|
|
509
|
+
const { data: getAllRoleReq } = useLazyAsyncData(
|
|
510
|
+
`get-roles-${props.type}-${props.orgId}-${props.siteId}`,
|
|
511
|
+
() =>
|
|
512
|
+
getRoles({
|
|
513
|
+
org: props.orgId,
|
|
514
|
+
type: props.type,
|
|
515
|
+
site: props.siteId,
|
|
516
|
+
limit: 100,
|
|
517
|
+
})
|
|
477
518
|
);
|
|
478
519
|
|
|
479
520
|
watchEffect(() => {
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
<StatusChip
|
|
74
74
|
:dot="false"
|
|
75
75
|
tone="info"
|
|
76
|
-
:label="
|
|
76
|
+
:label="getPermissionCount(value)"
|
|
77
77
|
/>
|
|
78
78
|
</template>
|
|
79
79
|
|
|
@@ -410,8 +410,34 @@ const edit = ref(false);
|
|
|
410
410
|
|
|
411
411
|
const roleId = ref("");
|
|
412
412
|
|
|
413
|
-
|
|
414
|
-
|
|
413
|
+
/*
|
|
414
|
+
* The chip counted only what a role HOLDS, so every role read "3" or "0" with
|
|
415
|
+
* nothing to compare it against -- and a role with none of them read a bare
|
|
416
|
+
* "0", which looks like a broken row rather than "nothing granted yet". It now
|
|
417
|
+
* reads `held / offered`, where `offered` is the size of the catalogue this
|
|
418
|
+
* screen was handed (`props.permissions`, the same tree the editor ticks).
|
|
419
|
+
*
|
|
420
|
+
* A role holding the `*` wildcard is shown as "All": its stored array has ONE
|
|
421
|
+
* entry, so counting it would have printed "1 / 127" for the role that can do
|
|
422
|
+
* everything -- the most misleading number on the screen.
|
|
423
|
+
*
|
|
424
|
+
* Display only. Nothing here decides what anybody may do; the ticks in the
|
|
425
|
+
* editor and the server's own checks are untouched.
|
|
426
|
+
*/
|
|
427
|
+
const permissionCatalogueSize = computed(() =>
|
|
428
|
+
Object.values(props.permissions ?? {}).reduce(
|
|
429
|
+
(total: number, actions: any) =>
|
|
430
|
+
total + Object.keys(actions ?? {}).length,
|
|
431
|
+
0
|
|
432
|
+
)
|
|
433
|
+
);
|
|
434
|
+
|
|
435
|
+
function getPermissionCount(permissions: unknown): string {
|
|
436
|
+
const held = Array.isArray(permissions) ? permissions : [];
|
|
437
|
+
if (held.includes("*")) return "All";
|
|
438
|
+
|
|
439
|
+
const offered = permissionCatalogueSize.value;
|
|
440
|
+
return offered > 0 ? `${held.length} / ${offered}` : String(held.length);
|
|
415
441
|
}
|
|
416
442
|
|
|
417
443
|
function updateRolePermissionsInList(
|
package/composables/useRole.ts
CHANGED
|
@@ -55,18 +55,27 @@ export default function useRole() {
|
|
|
55
55
|
* deliberately does not check a role's site, because a site is not a tenant
|
|
56
56
|
* boundary. A site-scoped screen still gets the organisation's site-less
|
|
57
57
|
* roles, because `getRoles` matches those too.
|
|
58
|
+
*
|
|
59
|
+
* `type` narrows the TENANT half only, and is there so a caller that already
|
|
60
|
+
* filters by membership type keeps exactly the list it has today and only
|
|
61
|
+
* GAINS the org-less templates. The template read stays on
|
|
62
|
+
* `type: "organization"` whatever is passed: an org-less role is a template
|
|
63
|
+
* for any app, and `roleInvitable` does not compare a role's type against the
|
|
64
|
+
* invitation's app at all -- it only refuses the platform-staff type, which
|
|
65
|
+
* the `admin` filter below already drops.
|
|
58
66
|
*/
|
|
59
67
|
async function getInvitableRoles(
|
|
60
|
-
{ search = "", org = "", site = "", limit = 50 } = {} as {
|
|
68
|
+
{ search = "", org = "", site = "", type = "", limit = 50 } = {} as {
|
|
61
69
|
search?: string;
|
|
62
70
|
org?: string;
|
|
63
71
|
site?: string;
|
|
72
|
+
type?: string;
|
|
64
73
|
limit?: number;
|
|
65
74
|
}
|
|
66
75
|
) {
|
|
67
76
|
const [tenant, templates] = await Promise.all([
|
|
68
77
|
org
|
|
69
|
-
? getRoles({ search, org, site, limit })
|
|
78
|
+
? getRoles({ search, org, site, type, limit })
|
|
70
79
|
: Promise.resolve({ items: [] } as Record<string, any>),
|
|
71
80
|
getRoles({ search, type: "organization", limit }),
|
|
72
81
|
]);
|
|
@@ -219,6 +219,29 @@ export default function useSecurityPermission() {
|
|
|
219
219
|
description:
|
|
220
220
|
"Allows the user to remove a question from the system permanently.",
|
|
221
221
|
},
|
|
222
|
+
/*
|
|
223
|
+
* ENFORCED BY THE SERVER, OFFERED BY NOBODY — until now.
|
|
224
|
+
*
|
|
225
|
+
* `see-all-virtual-patrols` is the umbrella "see the patrols" right, as
|
|
226
|
+
* distinct from the route / question / log families around it. It is
|
|
227
|
+
* checked in `core` and in `web-app-property-management`, and it appeared
|
|
228
|
+
* in NO picker in the estate, so no role could ever be granted it and the
|
|
229
|
+
* check behind it answered only to `*` or an empty list.
|
|
230
|
+
*
|
|
231
|
+
* Not hypothetical: measured on PRODUCTION 2026-09-09, one active role
|
|
232
|
+
* holds it with **5 live members** behind it — granted before the picker
|
|
233
|
+
* lost it, and ungrantable to anybody since.
|
|
234
|
+
*
|
|
235
|
+
* Catalogue-only. This widens what may be OFFERED and grants nothing to
|
|
236
|
+
* anybody: an unticked action stays refused, exactly as it is today. Same
|
|
237
|
+
* shape as the nine `access-card-mgmt` strings that were added for the
|
|
238
|
+
* same reason.
|
|
239
|
+
*/
|
|
240
|
+
"see-all-virtual-patrols": {
|
|
241
|
+
check: true,
|
|
242
|
+
description:
|
|
243
|
+
"Allows the user to view all virtual patrols.",
|
|
244
|
+
},
|
|
222
245
|
"add-virtual-patrol-log": {
|
|
223
246
|
check: true,
|
|
224
247
|
description: "Allows the user to add a new log to the system.",
|
package/constants/permissions.ts
CHANGED
|
@@ -525,6 +525,13 @@ export const LEGACY_PERMISSION_ALIASES: Readonly<
|
|
|
525
525
|
// ships this spelling.
|
|
526
526
|
"work-orders:create-work-order": "work_orders:create-work-order",
|
|
527
527
|
"work-orders:see-all-work-orders": "work_orders:see-all-work-orders",
|
|
528
|
+
// The sibling that was missed. Every other hyphenated work-order spelling is
|
|
529
|
+
// aliased here, and `workOrder:see-work-order-details` and
|
|
530
|
+
// `work_order:see-work-order-details` both are too — this one, alone, was
|
|
531
|
+
// not. Measured on PRODUCTION 2026-09-09: **4 active roles hold it, with 8
|
|
532
|
+
// live members behind them**, and it resolved to nothing, so those people
|
|
533
|
+
// could not open a work order's details however the role was ticked.
|
|
534
|
+
"work-orders:see-work-order-details": "work_orders:see-work-order-details",
|
|
528
535
|
"work-orders:update-work-order": "work_orders:update-work-order",
|
|
529
536
|
"work-orders:delete-work-order": "work_orders:delete-work-order",
|
|
530
537
|
// Needed by: `-security`, which says `add-` where every other app says
|
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.3.
|
|
5
|
+
"version": "4.3.1",
|
|
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.",
|