@7365admin1/layer-common 4.0.3-staging.221 → 4.0.3-staging.223

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.
@@ -366,9 +366,11 @@ const props = defineProps({
366
366
  type: Boolean,
367
367
  default: true,
368
368
  },
369
+ // Fail closed. `AccessManagement` did not forward this, so the dialog's
370
+ // Assign control defaulted to open for every role.
369
371
  canAssignToPerson: {
370
372
  type: Boolean,
371
- default: true,
373
+ default: false,
372
374
  },
373
375
  isSelectedCardAssignedPhysical: {
374
376
  type: Boolean,
@@ -93,6 +93,10 @@
93
93
  </v-dialog>
94
94
 
95
95
  <!-- Preview Dialog -->
96
+ <!-- `can-assign-to-person` uses the same rule the list view applies to its
97
+ own Assign control (line 15). It was not forwarded at all, so the
98
+ dialog fell back to its default and offered Assign to a role the list
99
+ view denies it to. -->
96
100
  <AccessCardPreviewDialog
97
101
  v-model="previewDialog"
98
102
  :unit="selectedCard"
@@ -100,6 +104,7 @@
100
104
  :can-update="canUpdateAccessCard"
101
105
  :can-replace-access-card="canReplaceAccessCard"
102
106
  :can-delete-access-card="canDeleteAccessCard"
107
+ :can-assign-to-person="canUpdateAccessCard && canAssignAccessCard"
103
108
  :is-selected-card-assigned-physical="isSelectedCardAssignedPhysical"
104
109
  :is-selected-card-physical="isSelectedCardPhysical"
105
110
  :site-id="siteId"
@@ -36,8 +36,12 @@
36
36
  </v-dialog>
37
37
 
38
38
  <v-dialog v-if="canViewUnitDetails" v-model="dialogPreview" :width="smAndUp ? '70svw' : '100%'" persistent>
39
+ <!-- The host app passes `canUpdateUnit` / `canDeleteUnit` and they were
40
+ never forwarded, so `BuildingUnitFormEdit` fell back to its own
41
+ defaults and drew Update and Delete for a role that holds neither. -->
39
42
  <BuildingUnitFormEdit v-if="selectedBuildingUnit" @cancel="dialogPreview = false" @success="successUpdate()"
40
- @delete-unit="openDeleteDialog()" :roomFacility="selectedBuildingUnit" />
43
+ @delete-unit="openDeleteDialog()" :roomFacility="selectedBuildingUnit" :canUpdateUnit="canUpdateUnit"
44
+ :canDeleteUnit="canDeleteUnit" />
41
45
  </v-dialog>
42
46
 
43
47
  <v-dialog v-model="dialogDelete" :loading="deleteLoading" width="450" persistent>
@@ -304,13 +304,16 @@ const prop = defineProps({
304
304
  type: Object as PropType<TBuildingUnit>,
305
305
  required: true,
306
306
  },
307
+ // Fail closed. A caller that forgets these must not be handed Update and
308
+ // Delete by default -- that is what happened when `BuildingManagement/units`
309
+ // did not forward them.
307
310
  canUpdateUnit: {
308
311
  type: Boolean,
309
- default: true,
312
+ default: false,
310
313
  },
311
314
  canDeleteUnit: {
312
315
  type: Boolean,
313
- default: true,
316
+ default: false,
314
317
  }
315
318
  });
316
319
 
@@ -15,7 +15,33 @@ export default function useCleaningPermission() {
15
15
  roles: rolePermissions,
16
16
  invitations: invitationPermissions,
17
17
  "bulletin-board": bulletinBoardPermissions,
18
-
18
+
19
+ // `hasPermission` looks an action up as `catalogue[resource][action]`, so a
20
+ // resource with no key here can never answer anything but `false` -- the
21
+ // gate is then reachable only through the `"*"` short-circuit. These two
22
+ // were checked by `-hygiene` (`site-settings:can-view-site-settings`,
23
+ // `:can-manage-site-settings`, `toilet_locations:create-toilet-location`)
24
+ // and were missing from this catalogue entirely, so every non-wildcard role
25
+ // was refused. Action names and shape copied from the sibling module
26
+ // catalogues that already work -- `usePoolMaintenancePermission` and
27
+ // `useLandscapingPermission` both spell it exactly this way.
28
+ "site-settings": {
29
+ "can-view-site-settings": {
30
+ check: true,
31
+ description: "Allows the user to view site settings.",
32
+ },
33
+ "can-manage-site-settings": {
34
+ check: true,
35
+ description: "Allows the user to manage and update site settings.",
36
+ },
37
+ },
38
+ toilet_locations: {
39
+ "create-toilet-location": {
40
+ check: true,
41
+ description: "Allows the user to create/add a toilet location.",
42
+ },
43
+ },
44
+
19
45
  inventory: {
20
46
  "view-inventory": {
21
47
  check: true,
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.0.3-staging.221",
5
+ "version": "4.0.3-staging.223",
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.",