@7365admin1/layer-common 4.2.15 → 4.2.17

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,40 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 4.2.17
4
+
5
+ ### Patch Changes
6
+
7
+ - bd3614a: Move the security and landscape role catalogues into the layer
8
+
9
+ `useSecurityPermission` lived only in `web-app-security` and
10
+ `useLandscapingPermission` only in `web-app-landscape`. Each was one copy-paste
11
+ away from the drift `usePropertyPermission` actually suffered — 32 permissions
12
+ missing from `web-app-org`'s copy, including every `access-card-mgmt` string the
13
+ API enforces, so those modules could not be granted at all.
14
+
15
+ Both files move here verbatim (content unchanged, header added) and are pinned
16
+ by `test/shared-role-catalogues.test.mjs`: resource lists, both feedback
17
+ spellings, and every action in both catalogues driven through the real
18
+ `hasPermission` so no existing grant can become unreachable.
19
+
20
+ Additive in the layer. The app copies shadow these until the app PRs delete
21
+ them, so nothing changes for a consumer until it bumps and deletes.
22
+
23
+ ## 4.2.16
24
+
25
+ ### Patch Changes
26
+
27
+ - 7881181: Move the property-management and staff-console role catalogues into this layer.
28
+
29
+ Each existed twice in the apps. `usePropertyPermission` was byte-identical in
30
+ `web-app-org` and `web-app-property-management` only because org #189 had just
31
+ copied it across after finding the `-org` copy 32 permissions short.
32
+ `useAdminPermission` is still 107 lines apart between `web-app-admin` and
33
+ `web-app-org`. One copy here means one edit covers every consumer.
34
+
35
+ Additive: an app-local composable of the same name still shadows this one, so
36
+ no app changes behaviour until it deletes its copy.
37
+
3
38
  ## 4.2.15
4
39
 
5
40
  ### Patch Changes
@@ -625,11 +660,11 @@
625
660
  `utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
626
661
  own rule from two endpoints the console already calls, unprojected:
627
662
 
628
- GET /api/members/user/:user/app/admin the Seven365 staff membership
629
- GET /api/roles/id/:role that membership's role document
663
+ GET /api/members/user/:user/app/admin the Seven365 staff membership
664
+ GET /api/roles/id/:role that membership's role document
630
665
 
631
- owner = member.type === "admin" && role.type === "admin" && role.default === true
632
- staff = member.type === "admin" && role.type === "admin"
666
+ owner = member.type === "admin" && role.type === "admin" && role.default === true
667
+ staff = member.type === "admin" && role.type === "admin"
633
668
 
634
669
  `role.default` is the marker because it is the only property of a platform
635
670
  staff role no API caller can set - `role.controller.ts` validates create and
@@ -0,0 +1,167 @@
1
+ /**
2
+ * THE SEVEN365 STAFF CONSOLE ROLE CATALOGUE — the shared copy.
3
+ *
4
+ * Two copies existed and they had already drifted: `web-app-org`'s carried the
5
+ * eleven console resources (five of them added by org #186 — Subscription
6
+ * Management, SP Approvals, Marketplace Vendors, Terms & Privacy Policy and
7
+ * Activity History, which had no resource at all and so could not be expressed
8
+ * by any role editor), while `web-app-admin`'s still carried six. **107 lines
9
+ * apart.** `-admin` is retired by redirect but still deployed, so the stale
10
+ * catalogue was still the one its role editor would have drawn.
11
+ *
12
+ * It lives here now, once. See `usePropertyPermission` in this folder for how
13
+ * the shadowing works and why the app copies are deleted rather than left.
14
+ *
15
+ * This catalogue is no longer only drawing: `core/utils/console-permission.util.ts`
16
+ * mirrors it and `requireConsolePermission` enforces it on all 45 console gate
17
+ * call sites (core #2097, live from API-core build revision 35). A resource
18
+ * missing from this file is therefore a module nobody can be granted AND a
19
+ * module the server will refuse — keep the two in step.
20
+ *
21
+ * Nothing about the catalogue's CONTENT changed in the move: this is
22
+ * `web-app-org composables/useAdminPermission.ts` at `origin/main`, verbatim
23
+ * apart from this header replacing the old one.
24
+ */
25
+ export default function useAdminPermission() {
26
+ const { memberPermissions, rolePermissions } = useCommonPermissions();
27
+ const permissions: TPermissions = {
28
+ organizations: {
29
+ "see-all-organizations": {
30
+ check: true,
31
+ description: "Allows the user to view the list of all organizations.",
32
+ },
33
+ "see-organization-details": {
34
+ check: true,
35
+ description:
36
+ "Allows the user to view the details of a specific organization.",
37
+ },
38
+ },
39
+ "promo-codes": {
40
+ "create-promo-code": {
41
+ check: true,
42
+ description: "Allows the user to add new promo codes to the system.",
43
+ },
44
+ "see-promo-code-details": {
45
+ check: true,
46
+ description:
47
+ "Allows the user to view the details of a specific promo code.",
48
+ },
49
+ "edit-promo-code-details": {
50
+ check: true,
51
+ description:
52
+ "Allows the user to update the promo code’s name, discount value, and other settings.",
53
+ },
54
+ "change-promo-code-status": {
55
+ check: true,
56
+ description:
57
+ "Allows the user to activate, deactivate, or expire a promo code.",
58
+ },
59
+ "delete-promo-code": {
60
+ check: true,
61
+ description:
62
+ "Allows the user to remove a promo code from the system permanently.",
63
+ },
64
+ },
65
+ users: {
66
+ "see-all-users": {
67
+ check: true,
68
+ description: "Allows the user to view the list of all users.",
69
+ },
70
+ "see-user-details": {
71
+ check: true,
72
+ description: "Allows the user to view the details of a specific user.",
73
+ },
74
+ },
75
+ invitations: {
76
+ "create-invitation": {
77
+ check: true,
78
+ description:
79
+ "Allows the user to create a new invitation for a invitation to join the organization.",
80
+ },
81
+ "view-invitations": {
82
+ check: true,
83
+ description:
84
+ "Allows the user to view the list of all invitation in the organization.",
85
+ },
86
+ "cancel-invitation": {
87
+ check: true,
88
+ description:
89
+ "Allows the user to permanently remove a invitation from the organization.",
90
+ },
91
+ },
92
+ subscriptions: {
93
+ "see-all-subscriptions": {
94
+ check: true,
95
+ description:
96
+ "Allows the user to view the subscription plans offered to clients.",
97
+ },
98
+ "see-subscription-details": {
99
+ check: true,
100
+ description:
101
+ "Allows the user to view the details of a specific subscription plan.",
102
+ },
103
+ "manage-subscription": {
104
+ check: true,
105
+ description:
106
+ "Allows the user to create, edit, and change the status of subscription plans.",
107
+ },
108
+ },
109
+ "sp-approvals": {
110
+ "see-all-sp-approvals": {
111
+ check: true,
112
+ description:
113
+ "Allows the user to view service providers waiting for Seven365 approval.",
114
+ },
115
+ "approve-sp": {
116
+ check: true,
117
+ description:
118
+ "Allows the user to approve a service provider so it can trade on the platform.",
119
+ },
120
+ "reject-sp": {
121
+ check: true,
122
+ description: "Allows the user to reject a service provider's application.",
123
+ },
124
+ "delete-sp-approval": {
125
+ check: true,
126
+ description:
127
+ "Allows the user to remove a service provider's application permanently.",
128
+ },
129
+ },
130
+ "marketplace-vendors": {
131
+ "see-all-marketplace-vendors": {
132
+ check: true,
133
+ description: "Allows the user to view the list of all marketplace vendors.",
134
+ },
135
+ "see-marketplace-vendor-details": {
136
+ check: true,
137
+ description:
138
+ "Allows the user to view the details of a specific marketplace vendor.",
139
+ },
140
+ },
141
+ "platform-terms": {
142
+ "see-platform-terms": {
143
+ check: true,
144
+ description:
145
+ "Allows the user to view the platform's Terms of Use and Privacy Policy.",
146
+ },
147
+ "edit-platform-terms": {
148
+ check: true,
149
+ description:
150
+ "Allows the user to edit and publish the platform's Terms of Use and Privacy Policy.",
151
+ },
152
+ },
153
+ "activity-history": {
154
+ "see-activity-history": {
155
+ check: true,
156
+ description:
157
+ "Allows the user to view the record of actions taken on the Seven365 console.",
158
+ },
159
+ },
160
+ members: memberPermissions,
161
+ "roles-and-permissions": rolePermissions,
162
+ };
163
+
164
+ return {
165
+ permissions,
166
+ };
167
+ }
@@ -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
+ }