fix(xo-server/snapshot): allow self user that is member of a group to snapshot (#7129)

Introduced by a88798cc22
See Zammad#18478
This commit is contained in:
Pierre Donias
2023-10-26 16:08:43 +02:00
committed by GitHub
parent 55cb6042e8
commit 397b5cd56d
2 changed files with 7 additions and 1 deletions

View File

@@ -30,6 +30,7 @@
- [Usage report] Fix "Converting circular structure to JSON" error (PR [#7096](https://github.com/vatesfr/xen-orchestra/pull/7096))
- [Usage report] Fix "Cannot convert undefined or null to object" error (PR [#7092](https://github.com/vatesfr/xen-orchestra/pull/7092))
- [Plugin/transport-xmpp] Fix plugin load
- [Self Service] Fix Self users not being able to snapshot VMs when they're members of a user group (PR [#7129](https://github.com/vatesfr/xen-orchestra/pull/7129))
### Packages to release

View File

@@ -973,7 +973,12 @@ export const snapshot = defer(async function (
}
}
if (resourceSet === undefined || !resourceSet.subjects.includes(user.id)) {
// Workaround: allow Resource Set members to snapshot a VM even though they
// don't have operate permissions on the SR(s)
if (
resourceSet === undefined ||
(!resourceSet.subjects.includes(user.id) && !user.groups.some(groupId => resourceSet.subjects.includes(groupId)))
) {
await checkPermissionOnSrs.call(this, vm)
}