@7365admin1/layer-common 4.2.21 → 4.2.23
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,28 @@
|
|
|
1
1
|
# @iservice365/layer-common
|
|
2
2
|
|
|
3
|
+
## 4.2.23
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8290f3c: Remove the web/mobile split from the role permission dialogs
|
|
8
|
+
|
|
9
|
+
A role is one permission list. If a granted module also exists in a mobile app,
|
|
10
|
+
the grant applies there. The dialogs no longer draw a "Web and Mobile" / "Web
|
|
11
|
+
only" legend, no longer suffix module labels with "(Web Only)", no longer take a
|
|
12
|
+
`webOnlyResources` prop, and no longer write a `platform` onto new roles.
|
|
13
|
+
|
|
14
|
+
None of this was ever a gate: `webOnlyResources` was a hardcoded per-app array
|
|
15
|
+
that only chose a chip colour and a label suffix, and the role document's
|
|
16
|
+
`platform` field is read by nothing. Existing role documents are untouched.
|
|
17
|
+
|
|
18
|
+
## 4.2.22
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- 4977a90: Let the console's Roles and Permissions screen list every role a super admin can hand out.
|
|
23
|
+
|
|
24
|
+
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.
|
|
25
|
+
|
|
3
26
|
## 4.2.21
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
|
@@ -732,11 +755,11 @@
|
|
|
732
755
|
`utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
|
|
733
756
|
own rule from two endpoints the console already calls, unprojected:
|
|
734
757
|
|
|
735
|
-
|
|
736
|
-
|
|
758
|
+
GET /api/members/user/:user/app/admin the Seven365 staff membership
|
|
759
|
+
GET /api/roles/id/:role that membership's role document
|
|
737
760
|
|
|
738
|
-
|
|
739
|
-
|
|
761
|
+
owner = member.type === "admin" && role.type === "admin" && role.default === true
|
|
762
|
+
staff = member.type === "admin" && role.type === "admin"
|
|
740
763
|
|
|
741
764
|
`role.default` is the marker because it is the only property of a platform
|
|
742
765
|
staff role no API caller can set - `role.controller.ts` validates create and
|
|
@@ -36,19 +36,6 @@
|
|
|
36
36
|
</v-row>
|
|
37
37
|
</v-col>
|
|
38
38
|
|
|
39
|
-
<v-col cols="12" class="mt-3">
|
|
40
|
-
<div class="role-create__legend">
|
|
41
|
-
<span class="d-flex align-center ga-2">
|
|
42
|
-
<v-icon class="role-create__dot--both" size="14">mdi-circle</v-icon>
|
|
43
|
-
Web and Mobile
|
|
44
|
-
</span>
|
|
45
|
-
<span class="d-flex align-center ga-2">
|
|
46
|
-
<v-icon class="role-create__dot--web" size="14">mdi-circle</v-icon>
|
|
47
|
-
Web only
|
|
48
|
-
</span>
|
|
49
|
-
</div>
|
|
50
|
-
</v-col>
|
|
51
|
-
|
|
52
39
|
<v-col cols="12" class="mt-2">
|
|
53
40
|
<AppButton
|
|
54
41
|
variant="ghost"
|
|
@@ -73,7 +60,7 @@
|
|
|
73
60
|
<StatusChip
|
|
74
61
|
class="mr-3"
|
|
75
62
|
:dot="false"
|
|
76
|
-
|
|
63
|
+
tone="info"
|
|
77
64
|
:label="String(selectedActionCount(String(resourceKey)))"
|
|
78
65
|
/>
|
|
79
66
|
</template>
|
|
@@ -181,10 +168,6 @@ const props = defineProps({
|
|
|
181
168
|
type: Boolean,
|
|
182
169
|
default: true,
|
|
183
170
|
},
|
|
184
|
-
webOnlyResources: {
|
|
185
|
-
type: Array as PropType<string[]>,
|
|
186
|
-
default: () => [],
|
|
187
|
-
},
|
|
188
171
|
cancelText: {
|
|
189
172
|
type: String,
|
|
190
173
|
default: "Cancel",
|
|
@@ -213,12 +196,7 @@ const resourceLabels: Record<string, string> = {
|
|
|
213
196
|
};
|
|
214
197
|
|
|
215
198
|
function formatResourceLabel(key: string): string {
|
|
216
|
-
|
|
217
|
-
return props.webOnlyResources.includes(key) ? `${label} (Web Only)` : label;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
function isWebOnly(resource: string) {
|
|
221
|
-
return props.webOnlyResources.includes(resource);
|
|
199
|
+
return resourceLabels[key] ?? key.replace(/-/g, " ");
|
|
222
200
|
}
|
|
223
201
|
|
|
224
202
|
function isCategoryEnabled(resource: string) {
|
|
@@ -313,7 +291,6 @@ async function submit() {
|
|
|
313
291
|
type: props.type,
|
|
314
292
|
org: props.org,
|
|
315
293
|
site: props.siteId,
|
|
316
|
-
platform: "website",
|
|
317
294
|
});
|
|
318
295
|
emit("success");
|
|
319
296
|
} catch (error: any) {
|
|
@@ -381,25 +358,6 @@ const isAllSelected = computed(() => {
|
|
|
381
358
|
max-height: calc(100vh - 160px);
|
|
382
359
|
}
|
|
383
360
|
|
|
384
|
-
.role-create__legend {
|
|
385
|
-
display: flex;
|
|
386
|
-
align-items: center;
|
|
387
|
-
gap: 16px;
|
|
388
|
-
font-size: var(--fs-breadcrumb);
|
|
389
|
-
color: var(--text2);
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
/* Were `amber-darken-2` / `blue-darken-2` - fixed Vuetify hues that do not
|
|
393
|
-
follow the theme, and the same two the count chip used. Design tones now,
|
|
394
|
-
and the dot and the chip read the same `isWebOnly`, so they cannot drift. */
|
|
395
|
-
.role-create__dot--both {
|
|
396
|
-
color: var(--warn);
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
.role-create__dot--web {
|
|
400
|
-
color: var(--info);
|
|
401
|
-
}
|
|
402
|
-
|
|
403
361
|
/* Was a `variant="outlined"` v-card inside the card - a card on a card. It is
|
|
404
362
|
the list frame, so it takes the design's border and radius and no second
|
|
405
363
|
surface. */
|
|
@@ -7,16 +7,6 @@
|
|
|
7
7
|
<v-form v-model="validForm" :disabled="disable">
|
|
8
8
|
<v-row no-gutters>
|
|
9
9
|
<v-col cols="12" class="mt-4">
|
|
10
|
-
<div class="role-perm__legend">
|
|
11
|
-
<span class="d-flex align-center ga-2">
|
|
12
|
-
<v-icon class="role-perm__dot--both" size="14">mdi-circle</v-icon>
|
|
13
|
-
Web and Mobile
|
|
14
|
-
</span>
|
|
15
|
-
<span class="d-flex align-center ga-2">
|
|
16
|
-
<v-icon class="role-perm__dot--web" size="14">mdi-circle</v-icon>
|
|
17
|
-
Web only
|
|
18
|
-
</span>
|
|
19
|
-
</div>
|
|
20
10
|
<AppButton
|
|
21
11
|
v-if="edit"
|
|
22
12
|
variant="ghost"
|
|
@@ -36,7 +26,7 @@
|
|
|
36
26
|
<StatusChip
|
|
37
27
|
class="mr-3"
|
|
38
28
|
:dot="false"
|
|
39
|
-
|
|
29
|
+
tone="info"
|
|
40
30
|
:label="String(selectedActionCount(String(resourceKey)))"
|
|
41
31
|
/>
|
|
42
32
|
</template>
|
|
@@ -157,10 +147,6 @@ const props = defineProps({
|
|
|
157
147
|
type: Object,
|
|
158
148
|
default: () => ({}),
|
|
159
149
|
},
|
|
160
|
-
webOnlyResources: {
|
|
161
|
-
type: Array as PropType<string[]>,
|
|
162
|
-
default: () => [],
|
|
163
|
-
},
|
|
164
150
|
// "Update role". This dialog had no permission prop at all, so it showed Edit
|
|
165
151
|
// to everyone -- including on the seeded platform-owner role -- and the
|
|
166
152
|
// `canUpdateRole` the apps have been passing to `RolePermissionMain` in good
|
|
@@ -182,12 +168,7 @@ const resourceLabels: Record<string, string> = {
|
|
|
182
168
|
};
|
|
183
169
|
|
|
184
170
|
function formatResourceLabel(key: string) {
|
|
185
|
-
|
|
186
|
-
return props.webOnlyResources.includes(key) ? `${label} (Web Only)` : label;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
function isWebOnly(resource: string) {
|
|
190
|
-
return props.webOnlyResources.includes(resource);
|
|
171
|
+
return resourceLabels[key] ?? key.replace(/-/g, " ");
|
|
191
172
|
}
|
|
192
173
|
|
|
193
174
|
/**
|
|
@@ -340,27 +321,6 @@ async function submit() {
|
|
|
340
321
|
max-height: calc(100vh - 160px);
|
|
341
322
|
}
|
|
342
323
|
|
|
343
|
-
.role-perm__legend {
|
|
344
|
-
display: flex;
|
|
345
|
-
align-items: center;
|
|
346
|
-
gap: 16px;
|
|
347
|
-
margin-bottom: 12px;
|
|
348
|
-
font-size: var(--fs-breadcrumb);
|
|
349
|
-
color: var(--text2);
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
/* The two legend dots carried `amber-darken-2` and `blue-darken-2` - fixed
|
|
353
|
-
Vuetify hues that do not follow the theme, and the same two hues the count
|
|
354
|
-
chip beside each row used. Both are the design's tones now, and the chip and
|
|
355
|
-
the dot stay in step because they read the same `isWebOnly`. */
|
|
356
|
-
.role-perm__dot--both {
|
|
357
|
-
color: var(--warn);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
.role-perm__dot--web {
|
|
361
|
-
color: var(--info);
|
|
362
|
-
}
|
|
363
|
-
|
|
364
324
|
/* Was a `variant="outlined"` v-card, i.e. a card inside a card. It is the list
|
|
365
325
|
frame, so it takes the design's card border and radius without laying a
|
|
366
326
|
second surface over the first. */
|
|
@@ -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
|
|
@@ -86,7 +100,6 @@
|
|
|
86
100
|
:org="props.orgId"
|
|
87
101
|
:site-id="props.siteId"
|
|
88
102
|
:site-state="siteFieldShown"
|
|
89
|
-
:web-only-resources="props.webOnlyResources"
|
|
90
103
|
@success="success()"
|
|
91
104
|
:type="props.type"
|
|
92
105
|
@success:create-more="getRoles()"
|
|
@@ -104,7 +117,6 @@
|
|
|
104
117
|
:name="name"
|
|
105
118
|
:id="roleId"
|
|
106
119
|
:can-update-role="props.canUpdateRole"
|
|
107
|
-
:web-only-resources="props.webOnlyResources"
|
|
108
120
|
/>
|
|
109
121
|
</v-dialog>
|
|
110
122
|
|
|
@@ -221,15 +233,34 @@ const props = defineProps({
|
|
|
221
233
|
required: true,
|
|
222
234
|
default: "app",
|
|
223
235
|
},
|
|
236
|
+
/*
|
|
237
|
+
* The `type` the LIST is filtered by, when it differs from the `type` a
|
|
238
|
+
* newly created role is given.
|
|
239
|
+
*
|
|
240
|
+
* They were the same value, and on the Seven365 console that was the defect:
|
|
241
|
+
* the screen passed `type="admin"`, so it listed the 2 platform-staff roles
|
|
242
|
+
* and nothing else -- while the console's own "Invite Client" picker asks
|
|
243
|
+
* `GET /api/roles` with no `type` and is offered all 12 ORG-LESS roles
|
|
244
|
+
* (10 `type: "organization"` templates + those same 2). A super admin could
|
|
245
|
+
* therefore hand out ten roles the Roles and Permissions screen could not
|
|
246
|
+
* show, edit or delete.
|
|
247
|
+
*
|
|
248
|
+
* The server has always allowed it: an org-less role of ANY type goes to
|
|
249
|
+
* `requireConsolePermission("roles-and-permissions")`
|
|
250
|
+
* (`core role.controller requireRoleOrg`), so this only stops the UI hiding
|
|
251
|
+
* what the console may already manage. `null` keeps every other page exactly
|
|
252
|
+
* as it was; `""` means "do not filter by type", which for an org-less
|
|
253
|
+
* caller IS the administrative scope.
|
|
254
|
+
*/
|
|
255
|
+
listType: {
|
|
256
|
+
type: String,
|
|
257
|
+
default: null,
|
|
258
|
+
},
|
|
224
259
|
permissions: {
|
|
225
260
|
type: Object,
|
|
226
261
|
required: true,
|
|
227
262
|
default: () => ({}),
|
|
228
263
|
},
|
|
229
|
-
webOnlyResources: {
|
|
230
|
-
type: Array as PropType<string[]>,
|
|
231
|
-
default: () => [],
|
|
232
|
-
},
|
|
233
264
|
headers: {
|
|
234
265
|
type: Array as PropType<Array<Record<string, any>>>,
|
|
235
266
|
default: () => [
|
|
@@ -296,7 +327,7 @@ const {
|
|
|
296
327
|
_getRoles({
|
|
297
328
|
page: page.value,
|
|
298
329
|
search: headerSearch.value,
|
|
299
|
-
type: props.type,
|
|
330
|
+
type: props.listType ?? props.type,
|
|
300
331
|
org: props.orgId,
|
|
301
332
|
site: props.siteId,
|
|
302
333
|
}),
|
|
@@ -338,6 +369,19 @@ const emptyText = computed(() => {
|
|
|
338
369
|
return "No roles have been created yet.";
|
|
339
370
|
});
|
|
340
371
|
|
|
372
|
+
/**
|
|
373
|
+
* What KIND of role a row is, in the words the console needs.
|
|
374
|
+
*
|
|
375
|
+
* A role with no `org` is not a client's -- it is either the Seven365 console's
|
|
376
|
+
* own staff role (`type: "admin"`) or an org-less TEMPLATE that any invitation
|
|
377
|
+
* may hand out. Both are managed here; only the second one leaves this system.
|
|
378
|
+
*/
|
|
379
|
+
function scopeLabel(item: Record<string, any>) {
|
|
380
|
+
if (item?.type === "admin") return "Platform staff";
|
|
381
|
+
if (props.orgId) return "Organisation";
|
|
382
|
+
return "Client template";
|
|
383
|
+
}
|
|
384
|
+
|
|
341
385
|
function tableRowClickHandler(_: any, data: any) {
|
|
342
386
|
// "See role details". Ungated until now, which is why granting or withholding
|
|
343
387
|
// 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.
|
|
5
|
+
"version": "4.2.23",
|
|
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.",
|