@7365admin1/layer-common 4.47.0 → 4.49.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 4.49.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 7dc771c: Members list: a member holding a role that belongs to another site shows a warning chip ("<role> — belongs to <site>. Assign a role for this site.", server roleState "other-site"), and the Assign Role action in the row menu is highlighted whenever the role chip is a warning.
8
+
9
+ ## 4.48.0
10
+
11
+ ### Minor Changes
12
+
13
+ - c9871b2: Members list: the role chip shows the member's real role name, and a clear warning ("No role assigned - assign one", "<name> (deleted) - assign a new role", "Invalid role - assign a new role") when the server's roleState says the role is missing, deleted or another organisation's. Rows from an older server render as before.
14
+
3
15
  ## 4.47.0
4
16
 
5
17
  ### Minor Changes
@@ -1521,11 +1533,11 @@
1521
1533
  `utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
1522
1534
  own rule from two endpoints the console already calls, unprojected:
1523
1535
 
1524
- GET /api/members/user/:user/app/admin the Seven365 staff membership
1525
- GET /api/roles/id/:role that membership's role document
1536
+ GET /api/members/user/:user/app/admin the Seven365 staff membership
1537
+ GET /api/roles/id/:role that membership's role document
1526
1538
 
1527
- owner = member.type === "admin" && role.type === "admin" && role.default === true
1528
- staff = member.type === "admin" && role.type === "admin"
1539
+ owner = member.type === "admin" && role.type === "admin" && role.default === true
1540
+ staff = member.type === "admin" && role.type === "admin"
1529
1541
 
1530
1542
  `role.default` is the marker because it is the only property of a platform
1531
1543
  staff role no API caller can set - `role.controller.ts` validates create and
@@ -73,11 +73,19 @@
73
73
  <template #item.nature="{ item }">
74
74
  {{ replaceMatch(item.nature, "_", " ") }}
75
75
  </template>
76
- <!-- The role is a soft pill in the design, not a plain word. Same
77
- text, same column, same source field. -->
76
+ <!-- The role is a soft pill in the design, not a plain word. The
77
+ member's REAL role name; a deleted / other-organisation / missing
78
+ role says so instead of reading as a working grant
79
+ (memberRoleChip in utils/role.ts, server roleState). -->
78
80
  <template #item.roleName="{ item }">
79
- <StatusChip v-if="item.roleName" :dot="false" pill tone="info">
80
- {{ item.roleName }}
81
+ <StatusChip
82
+ v-if="memberRoleChip(item)"
83
+ :dot="false"
84
+ pill
85
+ :tone="memberRoleChip(item)?.tone"
86
+ data-test="member-role-chip"
87
+ >
88
+ {{ memberRoleChip(item)?.text }}
81
89
  </StatusChip>
82
90
  </template>
83
91
  <template #item.dateInvited="{ item }">
@@ -113,8 +121,20 @@
113
121
  />
114
122
  </template>
115
123
  <v-list>
124
+ <!-- Highlighted when the row's role chip is a warning (no /
125
+ deleted / other org / other site role): this is the fix. -->
116
126
  <v-list-item
117
127
  v-if="props.assignRole"
128
+ :class="{
129
+ 'text-warning font-weight-bold':
130
+ memberRoleChip(item)?.tone === 'warn',
131
+ }"
132
+ :prepend-icon="
133
+ memberRoleChip(item)?.tone === 'warn'
134
+ ? 'mdi-alert-circle-outline'
135
+ : undefined
136
+ "
137
+ data-test="member-assign-role"
118
138
  @click="
119
139
  setMember({
120
140
  dialog: true,
@@ -258,7 +278,7 @@
258
278
  </template>
259
279
 
260
280
  <script setup lang="ts">
261
- import { withCurrentRole } from "../utils/role";
281
+ import { memberRoleChip, withCurrentRole } from "../utils/role";
262
282
 
263
283
  const props = defineProps({
264
284
  /** The design's page title. Every app that mounts this screen calls it
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.47.0",
5
+ "version": "4.49.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.",
package/utils/role.ts CHANGED
@@ -26,3 +26,37 @@ export function withCurrentRole<T extends { _id?: unknown; name?: unknown }>(
26
26
  if (!currentId || list.some((r) => String(r?._id) === currentId)) return list;
27
27
  return [...list, { _id: currentId, name: currentName || currentId }];
28
28
  }
29
+
30
+ /**
31
+ * What the Members list's "Roles and Permission" chip says for one row.
32
+ *
33
+ * The server's `roleState` (core 2026-09-25) says whether `roleName` is a role
34
+ * the member can really use. A bare name for a deleted role, another
35
+ * organisation's role, or no role at all read as a working grant (owner report:
36
+ * a member showed "Security" and Assign Role could not fix it). Rows from an
37
+ * older server carry no `roleState` and render exactly as before.
38
+ */
39
+ export function memberRoleChip(item: {
40
+ roleName?: unknown;
41
+ roleState?: unknown;
42
+ roleSiteName?: unknown;
43
+ }): { text: string; tone: "info" | "warn" } | null {
44
+ const name = typeof item?.roleName === "string" ? item.roleName : "";
45
+ switch (item?.roleState) {
46
+ case "missing":
47
+ return { text: "No role assigned - assign one", tone: "warn" };
48
+ case "deleted":
49
+ return { text: `${name || "Role"} (deleted) - assign a new role`, tone: "warn" };
50
+ case "other-org":
51
+ return { text: "Invalid role - assign a new role", tone: "warn" };
52
+ // The organisation's own role, but pinned to a different site than this
53
+ // membership's (owner report 2026-09-25: a Newton 200 member showed
54
+ // "Security", a role of The Loft).
55
+ case "other-site": {
56
+ const site = typeof item?.roleSiteName === "string" && item.roleSiteName ? item.roleSiteName : "another site";
57
+ return { text: `${name || "Role"} — belongs to ${site}. Assign a role for this site.`, tone: "warn" };
58
+ }
59
+ default:
60
+ return name ? { text: name, tone: "info" } : null;
61
+ }
62
+ }