fix(xo-web/home): don't make VM's resource set name clickable for non-admins (#6252)
See https://xcp-ng.org/forum/topic/5902/permissions-for-users-to-be-able-to-snapshot/5?_=1653902135402 Non-admin users aren't allowed to view the Self Service page so it doesn't make sense to have a link to that page
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
- [S3] Fix S3 remote with empty directory not showing anything to restore (PR [#6218](https://github.com/vatesfr/xen-orchestra/pull/6218))
|
||||
- [S3] remote fom did not save the `https` and `allow unatuhorized`during remote creation (PR [#6219](https://github.com/vatesfr/xen-orchestra/pull/6219))
|
||||
- [VM/advanced] Fix various errors when adding ACLs [#6213](https://github.com/vatesfr/xen-orchestra/issues/6213) (PR [#6230](https://github.com/vatesfr/xen-orchestra/pull/6230))
|
||||
- [Home/Self] Don't make VM's resource set name clickable for non admin users as they aren't allowed to view the Self Service page (PR [#6252](https://github.com/vatesfr/xen-orchestra/pull/6252))
|
||||
|
||||
### Packages to release
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import { Text, XoSelect } from 'editable'
|
||||
import { isEmpty, map } from 'lodash'
|
||||
import { addTag, editVm, fetchVmStats, migrateVm, removeTag, startVm, stopVm, subscribeResourceSets } from 'xo'
|
||||
import { addSubscriptions, connectStore, formatSizeShort, osFamily } from 'utils'
|
||||
import { createFinder, createGetObject, createGetVmDisks, createSelector, createSumBy } from 'selectors'
|
||||
import { createFinder, createGetObject, createGetVmDisks, createSelector, createSumBy, isAdmin } from 'selectors'
|
||||
|
||||
import MiniStats from './mini-stats'
|
||||
import styles from './index.css'
|
||||
@@ -23,6 +23,7 @@ import styles from './index.css'
|
||||
})
|
||||
@connectStore(() => ({
|
||||
container: createGetObject((_, props) => props.item.$container),
|
||||
isAdmin,
|
||||
totalDiskSize: createSumBy(
|
||||
createGetVmDisks((_, props) => props.item),
|
||||
'size'
|
||||
@@ -65,7 +66,7 @@ export default class VmItem extends Component {
|
||||
)
|
||||
|
||||
render() {
|
||||
const { item: vm, container, expandAll, selected } = this.props
|
||||
const { item: vm, container, expandAll, isAdmin, selected } = this.props
|
||||
const resourceSet = this._getResourceSet()
|
||||
const state = this._getVmState()
|
||||
|
||||
@@ -189,7 +190,11 @@ export default class VmItem extends Component {
|
||||
{resourceSet && (
|
||||
<span>
|
||||
{_('homeResourceSet', {
|
||||
resourceSet: <Link to={`self?resourceSet=${resourceSet.id}`}>{resourceSet.name}</Link>,
|
||||
resourceSet: isAdmin ? (
|
||||
<Link to={`self?resourceSet=${resourceSet.id}`}>{resourceSet.name}</Link>
|
||||
) : (
|
||||
resourceSet.name
|
||||
),
|
||||
})}
|
||||
</span>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user