@7365admin1/layer-common 4.159.0 → 4.160.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/CHANGELOG.md +10 -4
- package/package.json +1 -1
- package/plugins/secure-member.client.ts +15 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @iservice365/layer-common
|
|
2
2
|
|
|
3
|
+
## 4.160.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 3f9db2d: An app can now opt in to sending the site on the member lookup, so its role follows the site it is on (owner answer Q16), without waiting for `SEND_SITE` to be turned on for every app. Set `runtimeConfig.public.roleFollowsSite: true` in the app's own nuxt.config (or `NUXT_PUBLIC_ROLE_FOLLOWS_SITE=true`). Apps that do not set it send exactly the request they send today.
|
|
8
|
+
|
|
3
9
|
## 4.159.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -3644,11 +3650,11 @@ Monthly report: a month that had patrols opens the list of that month's patrol r
|
|
|
3644
3650
|
`utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
|
|
3645
3651
|
own rule from two endpoints the console already calls, unprojected:
|
|
3646
3652
|
|
|
3647
|
-
|
|
3648
|
-
|
|
3653
|
+
GET /api/members/user/:user/app/admin the Seven365 staff membership
|
|
3654
|
+
GET /api/roles/id/:role that membership's role document
|
|
3649
3655
|
|
|
3650
|
-
|
|
3651
|
-
|
|
3656
|
+
owner = member.type === "admin" && role.type === "admin" && role.default === true
|
|
3657
|
+
staff = member.type === "admin" && role.type === "admin"
|
|
3652
3658
|
|
|
3653
3659
|
`role.default` is the marker because it is the only property of a platform
|
|
3654
3660
|
staff role no API caller can set - `role.controller.ts` validates create and
|
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.
|
|
5
|
+
"version": "4.160.0",
|
|
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.",
|
|
@@ -39,6 +39,19 @@ export const LOOKUP_TIMEOUT_MS = 5000;
|
|
|
39
39
|
*/
|
|
40
40
|
export const SEND_SITE = false;
|
|
41
41
|
|
|
42
|
+
/*
|
|
43
|
+
* Per app opt in, ahead of the switch above: an app that sets
|
|
44
|
+
* `runtimeConfig.public.roleFollowsSite` to true (or the env var
|
|
45
|
+
* `NUXT_PUBLIC_ROLE_FOLLOWS_SITE=true`) sends the site now, so its role follows
|
|
46
|
+
* the site while every other app keeps today's answer. Declare the key in the
|
|
47
|
+
* APP's own nuxt.config, never in this layer's, or an env var in any app's
|
|
48
|
+
* deploy could turn it on there. Absent or misspelled means off.
|
|
49
|
+
*/
|
|
50
|
+
export function roleFollowsSite(): boolean {
|
|
51
|
+
const value = useRuntimeConfig().public.roleFollowsSite;
|
|
52
|
+
return SEND_SITE || value === true || value === "true";
|
|
53
|
+
}
|
|
54
|
+
|
|
42
55
|
function bounded<T>(request: Promise<T>): Promise<T> {
|
|
43
56
|
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
44
57
|
const timeout = new Promise<never>((_, reject) => {
|
|
@@ -111,7 +124,7 @@ export default defineNuxtPlugin(() => {
|
|
|
111
124
|
// it when the answer can actually DIFFER: the first resolution, or a site
|
|
112
125
|
// change while Q16 is on. While Q16 is held a site change re-asks the same
|
|
113
126
|
// question, so the resolved role stays on screen and nothing flickers.
|
|
114
|
-
if (resolvedFor === null ||
|
|
127
|
+
if (resolvedFor === null || roleFollowsSite()) userAppRoleStatus.value = "loading";
|
|
115
128
|
inFlightKey = key;
|
|
116
129
|
inFlight = run(userId, site, staffOrg).finally(() => {
|
|
117
130
|
inFlight = null;
|
|
@@ -139,7 +152,7 @@ export default defineNuxtPlugin(() => {
|
|
|
139
152
|
// adds is Q16 itself. Sending `org` as well would change the fallback
|
|
140
153
|
// too, and that is a separate change.
|
|
141
154
|
const member = await bounded(
|
|
142
|
-
getByUserType(userId, APP, undefined,
|
|
155
|
+
getByUserType(userId, APP, undefined, roleFollowsSite() && site ? site : undefined),
|
|
143
156
|
);
|
|
144
157
|
hasMemberDocument = true;
|
|
145
158
|
id.value = member.org ?? "";
|