@7365admin1/layer-common 4.2.17 → 4.2.19

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,51 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 4.2.19
4
+
5
+ ### Patch Changes
6
+
7
+ - 8196fa9: Add the `service-provider-mgmt` resource to the pest-control and pool-mgmt role catalogues
8
+
9
+ Both apps have a Service Providers page (`ServiceProviderMain`, same component
10
+ landscape uses) but `usePestControlPermission` and `usePoolMaintenancePermission`
11
+ carried no `service-provider-mgmt` resource, so the Roles & Permissions editor
12
+ could never grant it to a non-`"*"` role. Landscape already had this resource;
13
+ the same entry (`serviceProviderPermissions` from `useCommonPermissions`) is now
14
+ added to both, identical spelling and actions.
15
+
16
+ Widen only — no existing permission string is removed or re-spelled. The page's
17
+ live gate (`useServiceProviderPermission`, used inside `ServiceProviderMain`)
18
+ is unchanged: it already reads `service-provider-mgmt` off the role directly and
19
+ does not depend on either app's catalogue, so behaviour for every existing role
20
+ is unaffected. Pinned by `test/shared-role-catalogues.test.mjs`
21
+ (mechanical-electrical, which has no Service Providers page, is untouched and
22
+ still pins 15 resources; pest-control and pool-mgmt now pin 16).
23
+
24
+ ## 4.2.18
25
+
26
+ ### Patch Changes
27
+
28
+ - 5b81f17: Move the last three vertical role catalogues into the layer
29
+
30
+ `usePestControlPermission`, `usePoolMaintenancePermission` and
31
+ `useMechanicalElectricalPermission` lived only in `web-app-pest-control`,
32
+ `web-app-pool-mgmt` and `web-app-mechanical-electrical`. Same exposure as the
33
+ security and landscape pair: one copy-paste away from the drift
34
+ `usePropertyPermission` actually suffered, where 32 permissions were missing
35
+ from `web-app-org`'s copy and those modules could not be granted at all.
36
+
37
+ All three move here verbatim (content unchanged, header added) and are pinned by
38
+ `test/shared-role-catalogues.test.mjs`: the 15-resource list per vertical, a
39
+ grantable-action check, and every action in all three driven through the real
40
+ `hasPermission` so no existing grant can become unreachable. A made-up resource
41
+ is refused, as the control.
42
+
43
+ With these three every vertical role catalogue is in the layer and no web app
44
+ carries a private copy.
45
+
46
+ Additive in the layer. The app copies shadow these until the app PRs delete
47
+ them, so nothing changes for a consumer until it bumps and deletes.
48
+
3
49
  ## 4.2.17
4
50
 
5
51
  ### Patch Changes
@@ -660,11 +706,11 @@
660
706
  `utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
661
707
  own rule from two endpoints the console already calls, unprojected:
662
708
 
663
- GET /api/members/user/:user/app/admin the Seven365 staff membership
664
- GET /api/roles/id/:role that membership's role document
709
+ GET /api/members/user/:user/app/admin the Seven365 staff membership
710
+ GET /api/roles/id/:role that membership's role document
665
711
 
666
- owner = member.type === "admin" && role.type === "admin" && role.default === true
667
- staff = member.type === "admin" && role.type === "admin"
712
+ owner = member.type === "admin" && role.type === "admin" && role.default === true
713
+ staff = member.type === "admin" && role.type === "admin"
668
714
 
669
715
  `role.default` is the marker because it is the only property of a platform
670
716
  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,245 @@
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
+ serviceProviderPermissions,
27
+
28
+ } = useCommonPermissions();
29
+ const permissions: TPermissions = {
30
+ members: memberPermissions,
31
+ roles: rolePermissions,
32
+ invitations: invitationPermissions,
33
+ feedbacks: feedbackPermissions,
34
+ work_orders: workOrderPermissions,
35
+ "bulletin-board": bulletinBoardPermissions,
36
+ "service-provider-mgmt": serviceProviderPermissions,
37
+
38
+ "site-settings": {
39
+ "can-view-site-settings": {
40
+ check: true,
41
+ description: "Allows the user to view site settings.",
42
+ },
43
+ "can-manage-site-settings": {
44
+ check: true,
45
+ description: "Allows the user to manage and update site settings.",
46
+ },
47
+ },
48
+ // area management permissions
49
+ "area-mgmt": {
50
+ "see-all-areas": {
51
+ check: true,
52
+ description: "Allows the user to view the list of all areas for a site.",
53
+ },
54
+ "add-area": {
55
+ check: true,
56
+ description: "Allows the user to create/add an area to a site.",
57
+ },
58
+ "update-area": {
59
+ check: true,
60
+ description: "Allows the user to update/edit area details.",
61
+ },
62
+ "import-areas": {
63
+ check: true,
64
+ description: "Allows the user to import/upload areas via CSV/XLSX.",
65
+ },
66
+ "see-area-details": {
67
+ check: true,
68
+ description: "Allows the user to view detailed information for an area.",
69
+ },
70
+ "delete-area": {
71
+ check: true,
72
+ description: "Allows the user to delete/remove an area.",
73
+ },
74
+ },
75
+ // unit management permissions
76
+ "unit-mgmt": {
77
+ "see-all-units": {
78
+ check: true,
79
+ description: "Allows the user to view the list of all units for a site.",
80
+ },
81
+ "add-unit": {
82
+ check: true,
83
+ description: "Allows the user to create/add a unit to a site.",
84
+ },
85
+ "update-unit": {
86
+ check: true,
87
+ description: "Allows the user to update/edit unit details.",
88
+ },
89
+ "import-units": {
90
+ check: true,
91
+ description: "Allows the user to import/upload units via CSV/XLSX.",
92
+ },
93
+ "see-unit-details": {
94
+ check: true,
95
+ description: "Allows the user to view detailed information for a unit.",
96
+ },
97
+ "delete-unit": {
98
+ check: true,
99
+ description: "Allows the user to delete/remove a unit.",
100
+ },
101
+ },
102
+ // pest schedule management permissions
103
+ "pest-schedule-mgmt": {
104
+ "see-all-schedules": {
105
+ check: true,
106
+ description: "Allows the user to view the list of all pest schedules.",
107
+ },
108
+ "see-schedule-details": {
109
+ check: true,
110
+ description: "Allows the user to view detailed information for a pest schedule.",
111
+ },
112
+ "download-schedule": {
113
+ check: true,
114
+ description: "Allows the user to download pest schedule data.",
115
+ },
116
+ "manage-schedule-tasks": {
117
+ check: true,
118
+ description: "Allows the user to manage and update pest schedule tasks.",
119
+ },
120
+ "generate-checklist": {
121
+ check: true,
122
+ description: "Allows the user to generate new pest checklists.",
123
+ },
124
+ "view-history": {
125
+ check: true,
126
+ description: "Allows the user to view pest schedule history.",
127
+ },
128
+ "add-remarks": {
129
+ check: true,
130
+ description: "Allows the user to add remarks to pest tasks.",
131
+ },
132
+ },
133
+ // schedule task management permissions
134
+ "schedule-task-mgmt": {
135
+ "see-all-schedule-tasks": {
136
+ check: true,
137
+ description: "Allows the user to view the list of all schedule tasks.",
138
+ },
139
+ "add-schedule-task": {
140
+ check: true,
141
+ description: "Allows the user to create/add a new schedule task.",
142
+ },
143
+ "update-schedule-task": {
144
+ check: true,
145
+ description: "Allows the user to update/edit schedule task details.",
146
+ },
147
+ "delete-schedule-task": {
148
+ check: true,
149
+ description: "Allows the user to delete/remove a schedule task.",
150
+ },
151
+ "see-schedule-task-details": {
152
+ check: true,
153
+ description: "Allows the user to view detailed information for a schedule task.",
154
+ },
155
+ },
156
+ // attendance management permissions
157
+ "attendance-mgmt": {
158
+ "see-all-attendance": {
159
+ check: true,
160
+ description: "Allows the user to view all team members' attendance records.",
161
+ },
162
+ "see-attendance-details": {
163
+ check: true,
164
+ description: "Allows the user to view detailed information for an attendance record.",
165
+ },
166
+ "manage-attendance-settings": {
167
+ check: true,
168
+ description: "Allows the user to configure and manage attendance settings.",
169
+ },
170
+ },
171
+ // my attendance permissions
172
+ "my-attendance": {
173
+ "see-own-attendance": {
174
+ check: true,
175
+ description: "Allows the user to view their own attendance records.",
176
+ },
177
+ "check-in-out": {
178
+ check: true,
179
+ description: "Allows the user to check in and check out.",
180
+ },
181
+ },
182
+ // equipment management permissions
183
+ "supply-mgmt": {
184
+ "see-all-supplies": {
185
+ check: true,
186
+ description: "Allows the user to view the list of all equipments.",
187
+ },
188
+ "add-supply": {
189
+ check: true,
190
+ description: "Allows the user to create/add a new equipment item.",
191
+ },
192
+ "update-supply": {
193
+ check: true,
194
+ description: "Allows the user to update/edit equipment details.",
195
+ },
196
+ "delete-supply": {
197
+ check: true,
198
+ description: "Allows the user to delete/remove an equipment item.",
199
+ },
200
+ "add-stock": {
201
+ check: true,
202
+ description: "Allows the user to add stock to equipment items.",
203
+ },
204
+ "view-stock": {
205
+ check: true,
206
+ description: "Allows the user to view stock history and details.",
207
+ },
208
+ "checkout-item": {
209
+ check: true,
210
+ description: "Allows the user to checkout equipment items.",
211
+ },
212
+ },
213
+ // equipment items (checkout) management permissions
214
+ "checkout-item-mgmt": {
215
+ "see-all-checkouts": {
216
+ check: true,
217
+ description: "Allows the user to view all item checkouts.",
218
+ },
219
+ "create-checkout": {
220
+ check: true,
221
+ description: "Allows the user to create new item checkouts.",
222
+ },
223
+ "update-checkout": {
224
+ check: true,
225
+ description: "Allows the user to update/edit item checkouts.",
226
+ },
227
+ "approve-checkout": {
228
+ check: true,
229
+ description: "Allows the user to approve item checkouts.",
230
+ },
231
+ "disapprove-checkout": {
232
+ check: true,
233
+ description: "Allows the user to disapprove item checkouts.",
234
+ },
235
+ "view-checkout-details": {
236
+ check: true,
237
+ description: "Allows the user to view detailed information for item checkouts.",
238
+ },
239
+ },
240
+ };
241
+
242
+ return {
243
+ permissions,
244
+ };
245
+ }
@@ -0,0 +1,244 @@
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
+ serviceProviderPermissions,
27
+
28
+ } = useCommonPermissions();
29
+ const permissions: TPermissions = {
30
+ members: memberPermissions,
31
+ roles: rolePermissions,
32
+ invitations: invitationPermissions,
33
+ feedbacks: feedbackPermissions,
34
+ work_orders: workOrderPermissions,
35
+ "bulletin-board": bulletinBoardPermissions,
36
+ "service-provider-mgmt": serviceProviderPermissions,
37
+
38
+ "site-settings": {
39
+ "can-view-site-settings": {
40
+ check: true,
41
+ description: "Allows the user to view site settings.",
42
+ },
43
+ "can-manage-site-settings": {
44
+ check: true,
45
+ description: "Allows the user to manage and update site settings.",
46
+ },
47
+ },
48
+ // area management permissions
49
+ "area-mgmt": {
50
+ "see-all-areas": {
51
+ check: true,
52
+ description: "Allows the user to view the list of all areas for a site.",
53
+ },
54
+ "add-area": {
55
+ check: true,
56
+ description: "Allows the user to create/add an area to a site.",
57
+ },
58
+ "update-area": {
59
+ check: true,
60
+ description: "Allows the user to update/edit area details.",
61
+ },
62
+ "import-areas": {
63
+ check: true,
64
+ description: "Allows the user to import/upload areas via CSV/XLSX.",
65
+ },
66
+ "see-area-details": {
67
+ check: true,
68
+ description: "Allows the user to view detailed information for an area.",
69
+ },
70
+ "delete-area": {
71
+ check: true,
72
+ description: "Allows the user to delete/remove an area.",
73
+ },
74
+ },
75
+ // unit management permissions
76
+ "unit-mgmt": {
77
+ "see-all-units": {
78
+ check: true,
79
+ description: "Allows the user to view the list of all units for a site.",
80
+ },
81
+ "add-unit": {
82
+ check: true,
83
+ description: "Allows the user to create/add a unit to a site.",
84
+ },
85
+ "update-unit": {
86
+ check: true,
87
+ description: "Allows the user to update/edit unit details.",
88
+ },
89
+ "import-units": {
90
+ check: true,
91
+ description: "Allows the user to import/upload units via CSV/XLSX.",
92
+ },
93
+ "see-unit-details": {
94
+ check: true,
95
+ description: "Allows the user to view detailed information for a unit.",
96
+ },
97
+ "delete-unit": {
98
+ check: true,
99
+ description: "Allows the user to delete/remove a unit.",
100
+ },
101
+ },
102
+ // pool schedule management permissions
103
+ "pool-schedule-mgmt": {
104
+ "see-all-schedules": {
105
+ check: true,
106
+ description: "Allows the user to view the list of all pool schedules.",
107
+ },
108
+ "see-schedule-details": {
109
+ check: true,
110
+ description: "Allows the user to view detailed information for a pool schedule.",
111
+ },
112
+ "download-schedule": {
113
+ check: true,
114
+ description: "Allows the user to download pool schedule data.",
115
+ },
116
+ "manage-schedule-tasks": {
117
+ check: true,
118
+ description: "Allows the user to manage and update pool schedule tasks.",
119
+ },
120
+ "generate-checklist": {
121
+ check: true,
122
+ description: "Allows the user to generate new pool checklists.",
123
+ },
124
+ "view-history": {
125
+ check: true,
126
+ description: "Allows the user to view pool schedule history.",
127
+ },
128
+ "add-remarks": {
129
+ check: true,
130
+ description: "Allows the user to add remarks to pool tasks.",
131
+ },
132
+ },
133
+ // schedule task management permissions
134
+ "schedule-task-mgmt": {
135
+ "see-all-schedule-tasks": {
136
+ check: true,
137
+ description: "Allows the user to view the list of all schedule tasks.",
138
+ },
139
+ "add-schedule-task": {
140
+ check: true,
141
+ description: "Allows the user to create/add a new schedule task.",
142
+ },
143
+ "update-schedule-task": {
144
+ check: true,
145
+ description: "Allows the user to update/edit schedule task details.",
146
+ },
147
+ "delete-schedule-task": {
148
+ check: true,
149
+ description: "Allows the user to delete/remove a schedule task.",
150
+ },
151
+ "see-schedule-task-details": {
152
+ check: true,
153
+ description: "Allows the user to view detailed information for a schedule task.",
154
+ },
155
+ },
156
+ // attendance management permissions
157
+ "attendance-mgmt": {
158
+ "see-all-attendance": {
159
+ check: true,
160
+ description: "Allows the user to view all team members' attendance records.",
161
+ },
162
+ "see-attendance-details": {
163
+ check: true,
164
+ description: "Allows the user to view detailed information for an attendance record.",
165
+ },
166
+ "manage-attendance-settings": {
167
+ check: true,
168
+ description: "Allows the user to configure and manage attendance settings.",
169
+ },
170
+ },
171
+ // my attendance permissions
172
+ "my-attendance": {
173
+ "see-own-attendance": {
174
+ check: true,
175
+ description: "Allows the user to view their own attendance records.",
176
+ },
177
+ "check-in-out": {
178
+ check: true,
179
+ description: "Allows the user to check in and check out.",
180
+ },
181
+ },
182
+ // equipment management permissions
183
+ "supply-mgmt": {
184
+ "see-all-supplies": {
185
+ check: true,
186
+ description: "Allows the user to view the list of all equipments.",
187
+ },
188
+ "add-supply": {
189
+ check: true,
190
+ description: "Allows the user to create/add a new equipment item.",
191
+ },
192
+ "update-supply": {
193
+ check: true,
194
+ description: "Allows the user to update/edit equipment details.",
195
+ },
196
+ "delete-supply": {
197
+ check: true,
198
+ description: "Allows the user to delete/remove an equipment item.",
199
+ },
200
+ "add-stock": {
201
+ check: true,
202
+ description: "Allows the user to add stock to equipment items.",
203
+ },
204
+ "view-stock": {
205
+ check: true,
206
+ description: "Allows the user to view stock history and details.",
207
+ },
208
+ "checkout-item": {
209
+ check: true,
210
+ description: "Allows the user to checkout equipment items.",
211
+ },
212
+ },
213
+ // equipment items (checkout) management permissions
214
+ "checkout-item-mgmt": {
215
+ "see-all-checkouts": {
216
+ check: true,
217
+ description: "Allows the user to view all item checkouts.",
218
+ },
219
+ "create-checkout": {
220
+ check: true,
221
+ description: "Allows the user to create new item checkouts.",
222
+ },
223
+ "update-checkout": {
224
+ check: true,
225
+ description: "Allows the user to update/edit item checkouts.",
226
+ },
227
+ "approve-checkout": {
228
+ check: true,
229
+ description: "Allows the user to approve item checkouts.",
230
+ },
231
+ "disapprove-checkout": {
232
+ check: true,
233
+ description: "Allows the user to disapprove item checkouts.",
234
+ },
235
+ "view-checkout-details": {
236
+ check: true,
237
+ description: "Allows the user to view detailed information for item checkouts.",
238
+ },
239
+ },
240
+ };
241
+ return {
242
+ permissions,
243
+ };
244
+ }
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.19",
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.",