fix(xo-web/menu): don't subscribe to unhealthy vdi chains if not admin (#7265)

This commit is contained in:
OlivierFL
2024-01-03 18:11:34 +01:00
committed by GitHub
parent d8280087a4
commit 8b0b2d7c31
2 changed files with 7 additions and 2 deletions

View File

@@ -12,6 +12,7 @@
> Users must be able to say: “I had this issue, happy to know it's fixed”
- [Proxies] Fix `this.getObject` is not a function during deployment
- [Settings/Logs] Fix `sr.getAllUnhealthyVdiChainsLength: not enough permissions` error with non-admin users (PR [#7265](https://github.com/vatesfr/xen-orchestra/pull/7265))
### Packages to release

View File

@@ -34,7 +34,7 @@ import store from 'store'
import WarmMigrationModal from './warm-migration-modal'
import { alert, chooseAction, confirm } from '../modal'
import { error, info, success } from '../notification'
import { getObject } from 'selectors'
import { getObject, isAdmin } from 'selectors'
import { getXoaPlan, SOURCES } from '../xoa-plans'
import { noop, resolveId, resolveIds } from '../utils'
import {
@@ -564,7 +564,11 @@ subscribeVolumeInfo.forceRefresh = (() => {
}
})()
export const subscribeSrsUnhealthyVdiChainsLength = createSubscription(() => _call('sr.getAllUnhealthyVdiChainsLength'))
export const subscribeSrsUnhealthyVdiChainsLength = createSubscription(() => {
const _isAdmin = isAdmin(store.getState())
return _isAdmin ? _call('sr.getAllUnhealthyVdiChainsLength') : undefined
})
const unhealthyVdiChainsLengthSubscriptionsBySr = {}
export const createSrUnhealthyVdiChainsLengthSubscription = sr => {