@7365admin1/layer-common 4.97.1-staging.688 → 4.97.1-staging.690
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.
|
@@ -226,6 +226,7 @@ import {
|
|
|
226
226
|
ownerGrant,
|
|
227
227
|
siteModulesForOrg,
|
|
228
228
|
} from "../utils/org-modules";
|
|
229
|
+
import { withoutDeniedResources } from "../utils/module-routes";
|
|
229
230
|
|
|
230
231
|
const props = defineProps({
|
|
231
232
|
orgId: {
|
|
@@ -406,9 +407,17 @@ const { data: grantRole } = useLazyAsyncData(
|
|
|
406
407
|
{ watch: [grantRoleId] }
|
|
407
408
|
);
|
|
408
409
|
|
|
410
|
+
/*
|
|
411
|
+
* The deny list the server computed for this person (owner, 2026-11-16): a
|
|
412
|
+
* module the client's list removed - including a list saved with nothing
|
|
413
|
+
* ticked - is not offered either. Seven365 staff get an empty list, so the
|
|
414
|
+
* Super Admin still sees everything.
|
|
415
|
+
*/
|
|
416
|
+
const { userAppModulesDenied: deniedForEditor } = useLocalSetup();
|
|
417
|
+
|
|
409
418
|
/** `props.permissions`, narrowed to what this client - and this site - was given. */
|
|
410
419
|
const offeredPermissions = computed(() =>
|
|
411
|
-
catalogueForOwnerGrant(
|
|
420
|
+
withoutDeniedResources(catalogueForOwnerGrant(
|
|
412
421
|
catalogueForOrg(
|
|
413
422
|
props.permissions ?? {},
|
|
414
423
|
effectiveModules(
|
|
@@ -418,7 +427,7 @@ const offeredPermissions = computed(() =>
|
|
|
418
427
|
)
|
|
419
428
|
),
|
|
420
429
|
ownerGrant(orgForModules.value as any, grantRole.value as any, props.type)
|
|
421
|
-
)
|
|
430
|
+
), deniedForEditor?.value)
|
|
422
431
|
);
|
|
423
432
|
|
|
424
433
|
const { getRoles: _getRoles } = useRole();
|
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.97.1-staging.
|
|
5
|
+
"version": "4.97.1-staging.690",
|
|
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.",
|
package/utils/module-routes.ts
CHANGED
|
@@ -10,11 +10,19 @@
|
|
|
10
10
|
* FAILS OPEN. A route that is not listed here is allowed whatever the list says.
|
|
11
11
|
* Only prefixes whose page each app gates on exactly one module are listed
|
|
12
12
|
* (checked against every app's own `useLocalPermission` nav gate, 2026-09-11).
|
|
13
|
-
* Shared or ambiguous pages stay out:
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
13
|
+
* Shared or ambiguous pages stay out: equipment (every app's Equipment URL is a
|
|
14
|
+
* redirect to Inventory, no page of its own), the service-provider inventory
|
|
15
|
+
* page, support tickets and the org-level marketplace (vendor side, not
|
|
16
|
+
* `marketplace-mgmt`). The Pass & Key pages (`keys`) are gated on
|
|
17
|
+
* `passes-and-keys-mgmt` alone in both apps that have them (DV-0396), Cards and
|
|
18
|
+
* QR Tagging on `access-card-mgmt`, the service-provider list on
|
|
19
|
+
* `service-provider-mgmt`, Property Management's site Marketplace on
|
|
20
|
+
* `marketplace-mgmt`, CCTV Engine on `cctv-engine` and the four Security Ops
|
|
21
|
+
* pages on `security-ops`, so those ARE listed (2026-11-16). `cctv-mgmt` is
|
|
22
|
+
* catalogue-only: no page reads it, so there is nothing to map. The HID pages
|
|
23
|
+
* under access-mgmt are listed one by one, because each is gated on `hid-mgmt`
|
|
24
|
+
* alone (`useHidAccessPermission`); Cards is the bare `access-mgmt` route, so
|
|
25
|
+
* every page beside it MUST be listed or it would fall under the card module.
|
|
18
26
|
*
|
|
19
27
|
* NEVER MAPPED: the dashboard, settings, members, invitations and roles. A client
|
|
20
28
|
* must always be able to run its own people and roles; the server never denies
|
|
@@ -71,9 +79,21 @@ export const MODULE_ROUTES: Readonly<Record<string, string>> = Object.freeze({
|
|
|
71
79
|
"org-site-pool-schedule-area": "area-mgmt",
|
|
72
80
|
"org-site-pool-schedule-unit": "unit-mgmt",
|
|
73
81
|
"org-site-service-provider-mgmt": "service-provider-mgmt",
|
|
82
|
+
// The shared service-provider list in Security, Hygiene and the other trade apps
|
|
83
|
+
// (and Property Management): every app's menu reads `useServiceProviderPermission`,
|
|
84
|
+
// which is `service-provider-mgmt` (alias `service-provider`, same spelling group).
|
|
85
|
+
"org-site-service-providers": "service-provider-mgmt",
|
|
86
|
+
"org-site-marketplace": "marketplace-mgmt",
|
|
87
|
+
"org-site-keys": "passes-and-keys-mgmt",
|
|
88
|
+
"org-site-cctv-engine": "cctv-engine",
|
|
89
|
+
"org-site-security-ops": "security-ops",
|
|
90
|
+
// Cards is the bare `access-mgmt` route; every HID page and QR Tagging below
|
|
91
|
+
// is longer, so it wins. A new page under access-mgmt needs its own entry.
|
|
92
|
+
"org-site-access-mgmt": "access-card-mgmt",
|
|
93
|
+
"org-site-access-mgmt-qr-tagging": "access-card-mgmt",
|
|
74
94
|
// HID access management (decision of 2026-10-16): the seven HID pages under
|
|
75
|
-
// `access-mgmt`, named one by one so
|
|
76
|
-
//
|
|
95
|
+
// `access-mgmt`, named one by one so they stay apart from Cards and
|
|
96
|
+
// QR Tagging beside them. `hid-mgmt` is a governed module in core, so a client
|
|
77
97
|
// that was not given it loses the pages and the drawer group together.
|
|
78
98
|
"org-site-access-mgmt-hid-readers": "hid-mgmt",
|
|
79
99
|
"org-site-access-mgmt-administrator": "hid-mgmt",
|
|
@@ -133,6 +153,9 @@ export function permissionsDenied(
|
|
|
133
153
|
return permissions.every((p) => denied.includes(String(p).split(":")[0]));
|
|
134
154
|
}
|
|
135
155
|
|
|
156
|
+
/** Carved-out pages: shown to anyone, but never the only thing left in a trimmed group. */
|
|
157
|
+
const ROUTES_THAT_DONT_KEEP_A_GROUP = ["org-site-facility-settings"];
|
|
158
|
+
|
|
136
159
|
type TRouted = { route?: { name?: unknown } | null; children?: TRouted[] };
|
|
137
160
|
|
|
138
161
|
/** A menu without the pages the client was not given; a group left empty goes too. */
|
|
@@ -145,6 +168,30 @@ export function withoutDeniedRoutes<T extends TRouted>(
|
|
|
145
168
|
if (routeDenied(item.route?.name, denied)) return [];
|
|
146
169
|
if (!item.children?.length) return [item];
|
|
147
170
|
const children = withoutDeniedRoutes(item.children as T[], denied);
|
|
148
|
-
|
|
171
|
+
// A page carved out of its module (Facility Settings) must not keep a group
|
|
172
|
+
// alive on its own once the group's module pages were taken away.
|
|
173
|
+
const lost = children.length < item.children.length;
|
|
174
|
+
const stray = children.every((c) => ROUTES_THAT_DONT_KEEP_A_GROUP.includes(String(c.route?.name)));
|
|
175
|
+
return children.length && !(lost && stray) ? [{ ...item, children }] : [];
|
|
149
176
|
});
|
|
150
177
|
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* A permission catalogue (`{ resource: actions }`, what `RolePermissionMain`
|
|
181
|
+
* takes) without the modules the client's list took away, so a role editor
|
|
182
|
+
* never offers a box the client cannot use (owner, 2026-11-16). `denied` is the
|
|
183
|
+
* server's deny list (`useLocalSetup().userAppModulesDenied`), which already
|
|
184
|
+
* covers a list saved with nothing ticked and never holds an always-allowed
|
|
185
|
+
* module. No deny list: the same object back.
|
|
186
|
+
*/
|
|
187
|
+
export function withoutDeniedResources<T extends Record<string, unknown>>(
|
|
188
|
+
catalogue: T,
|
|
189
|
+
denied: readonly string[] | null | undefined,
|
|
190
|
+
): T {
|
|
191
|
+
if (!Array.isArray(denied) || !denied.length || !catalogue || typeof catalogue !== "object") {
|
|
192
|
+
return catalogue;
|
|
193
|
+
}
|
|
194
|
+
return Object.fromEntries(
|
|
195
|
+
Object.entries(catalogue).filter(([resource]) => !denied.includes(resource.trim())),
|
|
196
|
+
) as T;
|
|
197
|
+
}
|