@7365admin1/layer-common 4.2.17 → 4.2.18

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,30 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 4.2.18
4
+
5
+ ### Patch Changes
6
+
7
+ - 5b81f17: Move the last three vertical role catalogues into the layer
8
+
9
+ `usePestControlPermission`, `usePoolMaintenancePermission` and
10
+ `useMechanicalElectricalPermission` lived only in `web-app-pest-control`,
11
+ `web-app-pool-mgmt` and `web-app-mechanical-electrical`. Same exposure as the
12
+ security and landscape pair: one copy-paste away from the drift
13
+ `usePropertyPermission` actually suffered, where 32 permissions were missing
14
+ from `web-app-org`'s copy and those modules could not be granted at all.
15
+
16
+ All three move here verbatim (content unchanged, header added) and are pinned by
17
+ `test/shared-role-catalogues.test.mjs`: the 15-resource list per vertical, a
18
+ grantable-action check, and every action in all three driven through the real
19
+ `hasPermission` so no existing grant can become unreachable. A made-up resource
20
+ is refused, as the control.
21
+
22
+ With these three every vertical role catalogue is in the layer and no web app
23
+ carries a private copy.
24
+
25
+ Additive in the layer. The app copies shadow these until the app PRs delete
26
+ them, so nothing changes for a consumer until it bumps and deletes.
27
+
3
28
  ## 4.2.17
4
29
 
5
30
  ### Patch Changes
@@ -660,11 +685,11 @@
660
685
  `utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
661
686
  own rule from two endpoints the console already calls, unprojected:
662
687
 
663
- GET /api/members/user/:user/app/admin the Seven365 staff membership
664
- GET /api/roles/id/:role that membership's role document
688
+ GET /api/members/user/:user/app/admin the Seven365 staff membership
689
+ GET /api/roles/id/:role that membership's role document
665
690
 
666
- owner = member.type === "admin" && role.type === "admin" && role.default === true
667
- staff = member.type === "admin" && role.type === "admin"
691
+ owner = member.type === "admin" && role.type === "admin" && role.default === true
692
+ staff = member.type === "admin" && role.type === "admin"
668
693
 
669
694
  `role.default` is the marker because it is the only property of a platform
670
695
  staff role no API caller can set - `role.controller.ts` validates create and
@@ -0,0 +1,58 @@
1
+ /**
2
+ * THE MECHANICAL & ELECTRICAL ROLE CATALOGUE — the shared copy.
3
+ *
4
+ * Same reason as `useSecurityPermission` and `useLandscapingPermission` in this
5
+ * folder: it lived only in `web-app-mechanical-electrical`, one copy-paste away from the
6
+ * 32-permission drift that `usePropertyPermission` actually suffered. An
7
+ * app-local composable SHADOWS a layer one silently, so this file does nothing
8
+ * until the app copy is DELETED — which the accompanying app PR does.
9
+ *
10
+ * `hasPermission` resolves an action as `catalogue[resource][action]`: a
11
+ * resource missing here can only ever answer `false`, and no role editor can
12
+ * express the module. Widen, never swap.
13
+ *
14
+ * Nothing about the catalogue's CONTENT changed in the move: this is
15
+ * `web-app-mechanical-electrical composables/useMechanicalElectricalPermission.ts` at `origin/main`,
16
+ * verbatim apart from this header. Pinned by `test/shared-role-catalogues.test.mjs`.
17
+ */
18
+ export default function useMechanicalElectricalPermission() {
19
+ const {
20
+ invitationPermissions,
21
+ memberPermissions,
22
+ rolePermissions,
23
+ feedbackPermissions,
24
+ workOrderPermissions,
25
+ bulletinBoardPermissions,
26
+
27
+ } = useCommonPermissions();
28
+ const { permissions: schedulePermissions } = useCleaningPermission();
29
+
30
+ const permissions: TPermissions = {
31
+ members: memberPermissions,
32
+ roles: rolePermissions,
33
+ invitations: invitationPermissions,
34
+ feedbacks: feedbackPermissions,
35
+ work_orders: workOrderPermissions,
36
+ "bulletin-board": bulletinBoardPermissions,
37
+ // This app's sidebar gates Area, Unit and Settings on `area-mgmt`,
38
+ // `unit-mgmt` and `site-settings`, and its pages exist -- but the catalogue
39
+ // below is also the second half of every `hasPermission()` call, so leaving
40
+ // the three out made those gates unsatisfiable by anything except a `*`
41
+ // wildcard, and unofferable in this app's role editor. Adding them grants
42
+ // nobody anything on its own: a role still has to hold the string.
43
+ "area-mgmt": schedulePermissions["area-mgmt"],
44
+ "unit-mgmt": schedulePermissions["unit-mgmt"],
45
+ "site-settings": schedulePermissions["site-settings"],
46
+ "cleaning-schedule-mgmt": schedulePermissions["cleaning-schedule-mgmt"],
47
+ "schedule-task-mgmt": schedulePermissions["schedule-task-mgmt"],
48
+ "attendance-mgmt": schedulePermissions["attendance-mgmt"],
49
+ "my-attendance": schedulePermissions["my-attendance"],
50
+ "supply-mgmt": schedulePermissions["supply-mgmt"],
51
+ "checkout-item-mgmt": schedulePermissions["checkout-item-mgmt"],
52
+
53
+ };
54
+
55
+ return {
56
+ permissions,
57
+ };
58
+ }
@@ -0,0 +1,243 @@
1
+ /**
2
+ * THE PEST CONTROL ROLE CATALOGUE — the shared copy.
3
+ *
4
+ * Same reason as `useSecurityPermission` and `useLandscapingPermission` in this
5
+ * folder: it lived only in `web-app-pest-control`, one copy-paste away from the
6
+ * 32-permission drift that `usePropertyPermission` actually suffered. An
7
+ * app-local composable SHADOWS a layer one silently, so this file does nothing
8
+ * until the app copy is DELETED — which the accompanying app PR does.
9
+ *
10
+ * `hasPermission` resolves an action as `catalogue[resource][action]`: a
11
+ * resource missing here can only ever answer `false`, and no role editor can
12
+ * express the module. Widen, never swap.
13
+ *
14
+ * Nothing about the catalogue's CONTENT changed in the move: this is
15
+ * `web-app-pest-control composables/usePestControlPermission.ts` at `origin/main`,
16
+ * verbatim apart from this header. Pinned by `test/shared-role-catalogues.test.mjs`.
17
+ */
18
+ export default function usePestControlPermission() {
19
+ const {
20
+ invitationPermissions,
21
+ memberPermissions,
22
+ rolePermissions,
23
+ feedbackPermissions,
24
+ workOrderPermissions,
25
+ bulletinBoardPermissions,
26
+
27
+ } = useCommonPermissions();
28
+ const permissions: TPermissions = {
29
+ members: memberPermissions,
30
+ roles: rolePermissions,
31
+ invitations: invitationPermissions,
32
+ feedbacks: feedbackPermissions,
33
+ work_orders: workOrderPermissions,
34
+ "bulletin-board": bulletinBoardPermissions,
35
+
36
+ "site-settings": {
37
+ "can-view-site-settings": {
38
+ check: true,
39
+ description: "Allows the user to view site settings.",
40
+ },
41
+ "can-manage-site-settings": {
42
+ check: true,
43
+ description: "Allows the user to manage and update site settings.",
44
+ },
45
+ },
46
+ // area management permissions
47
+ "area-mgmt": {
48
+ "see-all-areas": {
49
+ check: true,
50
+ description: "Allows the user to view the list of all areas for a site.",
51
+ },
52
+ "add-area": {
53
+ check: true,
54
+ description: "Allows the user to create/add an area to a site.",
55
+ },
56
+ "update-area": {
57
+ check: true,
58
+ description: "Allows the user to update/edit area details.",
59
+ },
60
+ "import-areas": {
61
+ check: true,
62
+ description: "Allows the user to import/upload areas via CSV/XLSX.",
63
+ },
64
+ "see-area-details": {
65
+ check: true,
66
+ description: "Allows the user to view detailed information for an area.",
67
+ },
68
+ "delete-area": {
69
+ check: true,
70
+ description: "Allows the user to delete/remove an area.",
71
+ },
72
+ },
73
+ // unit management permissions
74
+ "unit-mgmt": {
75
+ "see-all-units": {
76
+ check: true,
77
+ description: "Allows the user to view the list of all units for a site.",
78
+ },
79
+ "add-unit": {
80
+ check: true,
81
+ description: "Allows the user to create/add a unit to a site.",
82
+ },
83
+ "update-unit": {
84
+ check: true,
85
+ description: "Allows the user to update/edit unit details.",
86
+ },
87
+ "import-units": {
88
+ check: true,
89
+ description: "Allows the user to import/upload units via CSV/XLSX.",
90
+ },
91
+ "see-unit-details": {
92
+ check: true,
93
+ description: "Allows the user to view detailed information for a unit.",
94
+ },
95
+ "delete-unit": {
96
+ check: true,
97
+ description: "Allows the user to delete/remove a unit.",
98
+ },
99
+ },
100
+ // pest schedule management permissions
101
+ "pest-schedule-mgmt": {
102
+ "see-all-schedules": {
103
+ check: true,
104
+ description: "Allows the user to view the list of all pest schedules.",
105
+ },
106
+ "see-schedule-details": {
107
+ check: true,
108
+ description: "Allows the user to view detailed information for a pest schedule.",
109
+ },
110
+ "download-schedule": {
111
+ check: true,
112
+ description: "Allows the user to download pest schedule data.",
113
+ },
114
+ "manage-schedule-tasks": {
115
+ check: true,
116
+ description: "Allows the user to manage and update pest schedule tasks.",
117
+ },
118
+ "generate-checklist": {
119
+ check: true,
120
+ description: "Allows the user to generate new pest checklists.",
121
+ },
122
+ "view-history": {
123
+ check: true,
124
+ description: "Allows the user to view pest schedule history.",
125
+ },
126
+ "add-remarks": {
127
+ check: true,
128
+ description: "Allows the user to add remarks to pest tasks.",
129
+ },
130
+ },
131
+ // schedule task management permissions
132
+ "schedule-task-mgmt": {
133
+ "see-all-schedule-tasks": {
134
+ check: true,
135
+ description: "Allows the user to view the list of all schedule tasks.",
136
+ },
137
+ "add-schedule-task": {
138
+ check: true,
139
+ description: "Allows the user to create/add a new schedule task.",
140
+ },
141
+ "update-schedule-task": {
142
+ check: true,
143
+ description: "Allows the user to update/edit schedule task details.",
144
+ },
145
+ "delete-schedule-task": {
146
+ check: true,
147
+ description: "Allows the user to delete/remove a schedule task.",
148
+ },
149
+ "see-schedule-task-details": {
150
+ check: true,
151
+ description: "Allows the user to view detailed information for a schedule task.",
152
+ },
153
+ },
154
+ // attendance management permissions
155
+ "attendance-mgmt": {
156
+ "see-all-attendance": {
157
+ check: true,
158
+ description: "Allows the user to view all team members' attendance records.",
159
+ },
160
+ "see-attendance-details": {
161
+ check: true,
162
+ description: "Allows the user to view detailed information for an attendance record.",
163
+ },
164
+ "manage-attendance-settings": {
165
+ check: true,
166
+ description: "Allows the user to configure and manage attendance settings.",
167
+ },
168
+ },
169
+ // my attendance permissions
170
+ "my-attendance": {
171
+ "see-own-attendance": {
172
+ check: true,
173
+ description: "Allows the user to view their own attendance records.",
174
+ },
175
+ "check-in-out": {
176
+ check: true,
177
+ description: "Allows the user to check in and check out.",
178
+ },
179
+ },
180
+ // equipment management permissions
181
+ "supply-mgmt": {
182
+ "see-all-supplies": {
183
+ check: true,
184
+ description: "Allows the user to view the list of all equipments.",
185
+ },
186
+ "add-supply": {
187
+ check: true,
188
+ description: "Allows the user to create/add a new equipment item.",
189
+ },
190
+ "update-supply": {
191
+ check: true,
192
+ description: "Allows the user to update/edit equipment details.",
193
+ },
194
+ "delete-supply": {
195
+ check: true,
196
+ description: "Allows the user to delete/remove an equipment item.",
197
+ },
198
+ "add-stock": {
199
+ check: true,
200
+ description: "Allows the user to add stock to equipment items.",
201
+ },
202
+ "view-stock": {
203
+ check: true,
204
+ description: "Allows the user to view stock history and details.",
205
+ },
206
+ "checkout-item": {
207
+ check: true,
208
+ description: "Allows the user to checkout equipment items.",
209
+ },
210
+ },
211
+ // equipment items (checkout) management permissions
212
+ "checkout-item-mgmt": {
213
+ "see-all-checkouts": {
214
+ check: true,
215
+ description: "Allows the user to view all item checkouts.",
216
+ },
217
+ "create-checkout": {
218
+ check: true,
219
+ description: "Allows the user to create new item checkouts.",
220
+ },
221
+ "update-checkout": {
222
+ check: true,
223
+ description: "Allows the user to update/edit item checkouts.",
224
+ },
225
+ "approve-checkout": {
226
+ check: true,
227
+ description: "Allows the user to approve item checkouts.",
228
+ },
229
+ "disapprove-checkout": {
230
+ check: true,
231
+ description: "Allows the user to disapprove item checkouts.",
232
+ },
233
+ "view-checkout-details": {
234
+ check: true,
235
+ description: "Allows the user to view detailed information for item checkouts.",
236
+ },
237
+ },
238
+ };
239
+
240
+ return {
241
+ permissions,
242
+ };
243
+ }
@@ -0,0 +1,242 @@
1
+ /**
2
+ * THE POOL MAINTENANCE ROLE CATALOGUE — the shared copy.
3
+ *
4
+ * Same reason as `useSecurityPermission` and `useLandscapingPermission` in this
5
+ * folder: it lived only in `web-app-pool-mgmt`, one copy-paste away from the
6
+ * 32-permission drift that `usePropertyPermission` actually suffered. An
7
+ * app-local composable SHADOWS a layer one silently, so this file does nothing
8
+ * until the app copy is DELETED — which the accompanying app PR does.
9
+ *
10
+ * `hasPermission` resolves an action as `catalogue[resource][action]`: a
11
+ * resource missing here can only ever answer `false`, and no role editor can
12
+ * express the module. Widen, never swap.
13
+ *
14
+ * Nothing about the catalogue's CONTENT changed in the move: this is
15
+ * `web-app-pool-mgmt composables/usePoolMaintenancePermission.ts` at `origin/main`,
16
+ * verbatim apart from this header. Pinned by `test/shared-role-catalogues.test.mjs`.
17
+ */
18
+ export default function usePoolMaintenancePermission() {
19
+ const {
20
+ invitationPermissions,
21
+ memberPermissions,
22
+ rolePermissions,
23
+ feedbackPermissions,
24
+ workOrderPermissions,
25
+ bulletinBoardPermissions,
26
+
27
+ } = useCommonPermissions();
28
+ const permissions: TPermissions = {
29
+ members: memberPermissions,
30
+ roles: rolePermissions,
31
+ invitations: invitationPermissions,
32
+ feedbacks: feedbackPermissions,
33
+ work_orders: workOrderPermissions,
34
+ "bulletin-board": bulletinBoardPermissions,
35
+
36
+ "site-settings": {
37
+ "can-view-site-settings": {
38
+ check: true,
39
+ description: "Allows the user to view site settings.",
40
+ },
41
+ "can-manage-site-settings": {
42
+ check: true,
43
+ description: "Allows the user to manage and update site settings.",
44
+ },
45
+ },
46
+ // area management permissions
47
+ "area-mgmt": {
48
+ "see-all-areas": {
49
+ check: true,
50
+ description: "Allows the user to view the list of all areas for a site.",
51
+ },
52
+ "add-area": {
53
+ check: true,
54
+ description: "Allows the user to create/add an area to a site.",
55
+ },
56
+ "update-area": {
57
+ check: true,
58
+ description: "Allows the user to update/edit area details.",
59
+ },
60
+ "import-areas": {
61
+ check: true,
62
+ description: "Allows the user to import/upload areas via CSV/XLSX.",
63
+ },
64
+ "see-area-details": {
65
+ check: true,
66
+ description: "Allows the user to view detailed information for an area.",
67
+ },
68
+ "delete-area": {
69
+ check: true,
70
+ description: "Allows the user to delete/remove an area.",
71
+ },
72
+ },
73
+ // unit management permissions
74
+ "unit-mgmt": {
75
+ "see-all-units": {
76
+ check: true,
77
+ description: "Allows the user to view the list of all units for a site.",
78
+ },
79
+ "add-unit": {
80
+ check: true,
81
+ description: "Allows the user to create/add a unit to a site.",
82
+ },
83
+ "update-unit": {
84
+ check: true,
85
+ description: "Allows the user to update/edit unit details.",
86
+ },
87
+ "import-units": {
88
+ check: true,
89
+ description: "Allows the user to import/upload units via CSV/XLSX.",
90
+ },
91
+ "see-unit-details": {
92
+ check: true,
93
+ description: "Allows the user to view detailed information for a unit.",
94
+ },
95
+ "delete-unit": {
96
+ check: true,
97
+ description: "Allows the user to delete/remove a unit.",
98
+ },
99
+ },
100
+ // pool schedule management permissions
101
+ "pool-schedule-mgmt": {
102
+ "see-all-schedules": {
103
+ check: true,
104
+ description: "Allows the user to view the list of all pool schedules.",
105
+ },
106
+ "see-schedule-details": {
107
+ check: true,
108
+ description: "Allows the user to view detailed information for a pool schedule.",
109
+ },
110
+ "download-schedule": {
111
+ check: true,
112
+ description: "Allows the user to download pool schedule data.",
113
+ },
114
+ "manage-schedule-tasks": {
115
+ check: true,
116
+ description: "Allows the user to manage and update pool schedule tasks.",
117
+ },
118
+ "generate-checklist": {
119
+ check: true,
120
+ description: "Allows the user to generate new pool checklists.",
121
+ },
122
+ "view-history": {
123
+ check: true,
124
+ description: "Allows the user to view pool schedule history.",
125
+ },
126
+ "add-remarks": {
127
+ check: true,
128
+ description: "Allows the user to add remarks to pool tasks.",
129
+ },
130
+ },
131
+ // schedule task management permissions
132
+ "schedule-task-mgmt": {
133
+ "see-all-schedule-tasks": {
134
+ check: true,
135
+ description: "Allows the user to view the list of all schedule tasks.",
136
+ },
137
+ "add-schedule-task": {
138
+ check: true,
139
+ description: "Allows the user to create/add a new schedule task.",
140
+ },
141
+ "update-schedule-task": {
142
+ check: true,
143
+ description: "Allows the user to update/edit schedule task details.",
144
+ },
145
+ "delete-schedule-task": {
146
+ check: true,
147
+ description: "Allows the user to delete/remove a schedule task.",
148
+ },
149
+ "see-schedule-task-details": {
150
+ check: true,
151
+ description: "Allows the user to view detailed information for a schedule task.",
152
+ },
153
+ },
154
+ // attendance management permissions
155
+ "attendance-mgmt": {
156
+ "see-all-attendance": {
157
+ check: true,
158
+ description: "Allows the user to view all team members' attendance records.",
159
+ },
160
+ "see-attendance-details": {
161
+ check: true,
162
+ description: "Allows the user to view detailed information for an attendance record.",
163
+ },
164
+ "manage-attendance-settings": {
165
+ check: true,
166
+ description: "Allows the user to configure and manage attendance settings.",
167
+ },
168
+ },
169
+ // my attendance permissions
170
+ "my-attendance": {
171
+ "see-own-attendance": {
172
+ check: true,
173
+ description: "Allows the user to view their own attendance records.",
174
+ },
175
+ "check-in-out": {
176
+ check: true,
177
+ description: "Allows the user to check in and check out.",
178
+ },
179
+ },
180
+ // equipment management permissions
181
+ "supply-mgmt": {
182
+ "see-all-supplies": {
183
+ check: true,
184
+ description: "Allows the user to view the list of all equipments.",
185
+ },
186
+ "add-supply": {
187
+ check: true,
188
+ description: "Allows the user to create/add a new equipment item.",
189
+ },
190
+ "update-supply": {
191
+ check: true,
192
+ description: "Allows the user to update/edit equipment details.",
193
+ },
194
+ "delete-supply": {
195
+ check: true,
196
+ description: "Allows the user to delete/remove an equipment item.",
197
+ },
198
+ "add-stock": {
199
+ check: true,
200
+ description: "Allows the user to add stock to equipment items.",
201
+ },
202
+ "view-stock": {
203
+ check: true,
204
+ description: "Allows the user to view stock history and details.",
205
+ },
206
+ "checkout-item": {
207
+ check: true,
208
+ description: "Allows the user to checkout equipment items.",
209
+ },
210
+ },
211
+ // equipment items (checkout) management permissions
212
+ "checkout-item-mgmt": {
213
+ "see-all-checkouts": {
214
+ check: true,
215
+ description: "Allows the user to view all item checkouts.",
216
+ },
217
+ "create-checkout": {
218
+ check: true,
219
+ description: "Allows the user to create new item checkouts.",
220
+ },
221
+ "update-checkout": {
222
+ check: true,
223
+ description: "Allows the user to update/edit item checkouts.",
224
+ },
225
+ "approve-checkout": {
226
+ check: true,
227
+ description: "Allows the user to approve item checkouts.",
228
+ },
229
+ "disapprove-checkout": {
230
+ check: true,
231
+ description: "Allows the user to disapprove item checkouts.",
232
+ },
233
+ "view-checkout-details": {
234
+ check: true,
235
+ description: "Allows the user to view detailed information for item checkouts.",
236
+ },
237
+ },
238
+ };
239
+ return {
240
+ permissions,
241
+ };
242
+ }
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.17",
5
+ "version": "4.2.18",
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.",