@7365admin1/layer-common 4.2.16 → 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,50 @@
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
+
28
+ ## 4.2.17
29
+
30
+ ### Patch Changes
31
+
32
+ - bd3614a: Move the security and landscape role catalogues into the layer
33
+
34
+ `useSecurityPermission` lived only in `web-app-security` and
35
+ `useLandscapingPermission` only in `web-app-landscape`. Each was one copy-paste
36
+ away from the drift `usePropertyPermission` actually suffered — 32 permissions
37
+ missing from `web-app-org`'s copy, including every `access-card-mgmt` string the
38
+ API enforces, so those modules could not be granted at all.
39
+
40
+ Both files move here verbatim (content unchanged, header added) and are pinned
41
+ by `test/shared-role-catalogues.test.mjs`: resource lists, both feedback
42
+ spellings, and every action in both catalogues driven through the real
43
+ `hasPermission` so no existing grant can become unreachable.
44
+
45
+ Additive in the layer. The app copies shadow these until the app PRs delete
46
+ them, so nothing changes for a consumer until it bumps and deletes.
47
+
3
48
  ## 4.2.16
4
49
 
5
50
  ### Patch Changes
@@ -640,11 +685,11 @@
640
685
  `utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
641
686
  own rule from two endpoints the console already calls, unprojected:
642
687
 
643
- GET /api/members/user/:user/app/admin the Seven365 staff membership
644
- 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
645
690
 
646
- owner = member.type === "admin" && role.type === "admin" && role.default === true
647
- 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"
648
693
 
649
694
  `role.default` is the marker because it is the only property of a platform
650
695
  staff role no API caller can set - `role.controller.ts` validates create and
@@ -0,0 +1,250 @@
1
+ /**
2
+ * THE LANDSCAPE ROLE CATALOGUE — the shared copy.
3
+ *
4
+ * Same reason as `useSecurityPermission` in this folder: it lived only in
5
+ * `web-app-landscape`, one copy-paste away from the 32-permission drift that
6
+ * `usePropertyPermission` actually suffered. An app-local composable SHADOWS a
7
+ * layer one silently, so this file does nothing until the app copy is DELETED —
8
+ * 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-landscape composables/useLandscapingPermission.ts` at `origin/main`,
16
+ * verbatim apart from this header. Pinned by `test/shared-role-catalogues.test.mjs`.
17
+ */
18
+ export default function useLandscapingPermission() {
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
+ inventory: {
38
+ "view-inventory": {
39
+ check: true,
40
+ description: "Allows the user to view the inventory list.",
41
+ },
42
+ },
43
+ // area management permissions
44
+ "area-mgmt": {
45
+ "see-all-areas": {
46
+ check: true,
47
+ description: "Allows the user to view the list of all areas for a site.",
48
+ },
49
+ "add-area": {
50
+ check: true,
51
+ description: "Allows the user to create/add an area to a site.",
52
+ },
53
+ "update-area": {
54
+ check: true,
55
+ description: "Allows the user to update/edit area details.",
56
+ },
57
+ "import-areas": {
58
+ check: true,
59
+ description: "Allows the user to import/upload areas via CSV/XLSX.",
60
+ },
61
+ "see-area-details": {
62
+ check: true,
63
+ description: "Allows the user to view detailed information for an area.",
64
+ },
65
+ "delete-area": {
66
+ check: true,
67
+ description: "Allows the user to delete/remove an area.",
68
+ },
69
+ },
70
+ // unit management permissions
71
+ "unit-mgmt": {
72
+ "see-all-units": {
73
+ check: true,
74
+ description: "Allows the user to view the list of all units for a site.",
75
+ },
76
+ "add-unit": {
77
+ check: true,
78
+ description: "Allows the user to create/add a unit to a site.",
79
+ },
80
+ "update-unit": {
81
+ check: true,
82
+ description: "Allows the user to update/edit unit details.",
83
+ },
84
+ "import-units": {
85
+ check: true,
86
+ description: "Allows the user to import/upload units via CSV/XLSX.",
87
+ },
88
+ "see-unit-details": {
89
+ check: true,
90
+ description: "Allows the user to view detailed information for a unit.",
91
+ },
92
+ "delete-unit": {
93
+ check: true,
94
+ description: "Allows the user to delete/remove a unit.",
95
+ },
96
+ },
97
+ // landscape schedule management permissions
98
+ "landscape-schedule-mgmt": {
99
+ "see-all-schedules": {
100
+ check: true,
101
+ description: "Allows the user to view the list of all cleaning schedules.",
102
+ },
103
+ "see-schedule-details": {
104
+ check: true,
105
+ description: "Allows the user to view detailed information for a cleaning schedule.",
106
+ },
107
+ "download-schedule": {
108
+ check: true,
109
+ description: "Allows the user to download cleaning schedule data.",
110
+ },
111
+ "manage-schedule-tasks": {
112
+ check: true,
113
+ description: "Allows the user to manage and update cleaning schedule tasks.",
114
+ },
115
+ "generate-checklist": {
116
+ check: true,
117
+ description: "Allows the user to generate new cleaning checklists.",
118
+ },
119
+ "view-history": {
120
+ check: true,
121
+ description: "Allows the user to view cleaning schedule history.",
122
+ },
123
+ "add-remarks": {
124
+ check: true,
125
+ description: "Allows the user to add remarks to cleaning tasks.",
126
+ },
127
+ },
128
+ // schedule task management permissions
129
+ "schedule-task-mgmt": {
130
+ "see-all-schedule-tasks": {
131
+ check: true,
132
+ description: "Allows the user to view the list of all schedule tasks.",
133
+ },
134
+ "add-schedule-task": {
135
+ check: true,
136
+ description: "Allows the user to create/add a new schedule task.",
137
+ },
138
+ "update-schedule-task": {
139
+ check: true,
140
+ description: "Allows the user to update/edit schedule task details.",
141
+ },
142
+ "delete-schedule-task": {
143
+ check: true,
144
+ description: "Allows the user to delete/remove a schedule task.",
145
+ },
146
+ "see-schedule-task-details": {
147
+ check: true,
148
+ description: "Allows the user to view detailed information for a schedule task.",
149
+ },
150
+ },
151
+ // attendance management permissions
152
+ "attendance-mgmt": {
153
+ "see-all-attendance": {
154
+ check: true,
155
+ description: "Allows the user to view all team members' attendance records.",
156
+ },
157
+ "see-attendance-details": {
158
+ check: true,
159
+ description: "Allows the user to view detailed information for an attendance record.",
160
+ },
161
+ "manage-attendance-settings": {
162
+ check: true,
163
+ description: "Allows the user to configure and manage attendance settings.",
164
+ },
165
+ },
166
+ // my attendance permissions
167
+ "my-attendance": {
168
+ "see-own-attendance": {
169
+ check: true,
170
+ description: "Allows the user to view their own attendance records.",
171
+ },
172
+ "check-in-out": {
173
+ check: true,
174
+ description: "Allows the user to check in and check out.",
175
+ },
176
+ },
177
+ // equipment management permissions
178
+ "supply-mgmt": {
179
+ "see-all-supplies": {
180
+ check: true,
181
+ description: "Allows the user to view the list of all equipments.",
182
+ },
183
+ "add-supply": {
184
+ check: true,
185
+ description: "Allows the user to create/add a new equipment item.",
186
+ },
187
+ "update-supply": {
188
+ check: true,
189
+ description: "Allows the user to update/edit equipment details.",
190
+ },
191
+ "delete-supply": {
192
+ check: true,
193
+ description: "Allows the user to delete/remove an equipment item.",
194
+ },
195
+ "add-stock": {
196
+ check: true,
197
+ description: "Allows the user to add stock to equipment items.",
198
+ },
199
+ "view-stock": {
200
+ check: true,
201
+ description: "Allows the user to view stock history and details.",
202
+ },
203
+ "checkout-item": {
204
+ check: true,
205
+ description: "Allows the user to checkout equipment items.",
206
+ },
207
+ },
208
+ // checkout item management permissions
209
+ "checkout-item-mgmt": {
210
+ "see-all-checkouts": {
211
+ check: true,
212
+ description: "Allows the user to view all item checkouts.",
213
+ },
214
+ "create-checkout": {
215
+ check: true,
216
+ description: "Allows the user to create new item checkouts.",
217
+ },
218
+ "update-checkout": {
219
+ check: true,
220
+ description: "Allows the user to update/edit item checkouts.",
221
+ },
222
+ "approve-checkout": {
223
+ check: true,
224
+ description: "Allows the user to approve item checkouts.",
225
+ },
226
+ "disapprove-checkout": {
227
+ check: true,
228
+ description: "Allows the user to disapprove item checkouts.",
229
+ },
230
+ "view-checkout-details": {
231
+ check: true,
232
+ description: "Allows the user to view detailed information for item checkouts.",
233
+ },
234
+ },
235
+ "site-settings": {
236
+ "can-view-site-settings": {
237
+ check: true,
238
+ description: "Allows the user to view site settings.",
239
+ },
240
+ "can-manage-site-settings": {
241
+ check: true,
242
+ description: "Allows the user to manage site settings.",
243
+ },
244
+ },
245
+ };
246
+
247
+ return {
248
+ permissions,
249
+ };
250
+ }
@@ -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
+ }