fix(xo-web/tasks): fix tasks being displayed to all users (#6422)

See zammad#9509
Introduced by e246c8ee47
This commit is contained in:
rajaa-b 2022-09-21 11:25:14 +02:00 committed by GitHub
parent 99a1dbeae1
commit ce78d22bb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 5 deletions

View File

@ -19,6 +19,7 @@
- [Backup] Launch Health Check after a full backup (PR [#6401](https://github.com/vatesfr/xen-orchestra/pull/6401))
- [Backup] Fix `Lock file is already being held` error when deleting a VM backup while the VM is currently being backed up
- [Tasks] Fix the pool filter that did not display tasks even if they existed (PR [#6424](https://github.com/vatesfr/xen-orchestra/pull/6424))
- [Tasks] Fix tasks being displayed for all users (PR [#6422](https://github.com/vatesfr/xen-orchestra/pull/6422))
### Packages to release

View File

@ -629,7 +629,8 @@ const getLinkedObjectsByTaskRefOrId = create(
export const getResolvedPendingTasks = create(
createGetObjectsOfType('task').filter([task => task.status === 'pending']),
getLinkedObjectsByTaskRefOrId,
(tasks, linkedObjectsByTaskRefOrId) => {
getCheckPermissions,
(tasks, linkedObjectsByTaskRefOrId, check) => {
const resolvedTasks = []
forEach(tasks, task => {
const objects = [
@ -638,10 +639,13 @@ export const getResolvedPendingTasks = create(
// { taskId → operation } map instead of { taskRef → operation } map
...defined(linkedObjectsByTaskRefOrId[task.id], []),
]
resolvedTasks.push({
...task,
objects,
})
if (objects.length > 0 || check(task.$host, 'view')) {
resolvedTasks.push({
...task,
objects,
})
}
})
return resolvedTasks
}