Skip to content

Commit

Permalink
fix(xo-server/snapshot): allow self user that is member of a group to…
Browse files Browse the repository at this point in the history
… snapshot (#7129)

Introduced by a88798c
See Zammad#18478
  • Loading branch information
pdonias authored Oct 26, 2023
1 parent 55cb604 commit 397b5cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 6 additions & 1 deletion packages/xo-server/src/api/vm.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 397b5cd

Please sign in to comment.