Skip to content

Commit

Permalink
fix(xo-web): do not subscribe to proxies if no permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierFL committed Dec 20, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 4784bbf commit bef5174
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
- [Host/Smart reboot] Automatically retries up to a minute when `HOST_STILL_BOOTING` [#7194](https://github.com/vatesfr/xen-orchestra/issues/7194) (PR [#7231](https://github.com/vatesfr/xen-orchestra/pull/7231))
- [Plugin/transport-slack] Compatibility with other services like Mattermost or Discord [#7130](https://github.com/vatesfr/xen-orchestra/issues/7130) (PR [#7220](https://github.com/vatesfr/xen-orchestra/pull/7220))
- [Host/Network] Fix error "PIF_IS_PHYSICAL" when trying to remove a PIF that had already been physically disconnected [#7193](https://github.com/vatesfr/xen-orchestra/issues/7193) (PR [#7221](https://github.com/vatesfr/xen-orchestra/pull/7221))
- [Menu/Proxies] Don't subscribe to proxies if user has not enough permissions (PR [#7249](https://github.com/vatesfr/xen-orchestra/pull/7249))

### Packages to release

@@ -45,5 +46,6 @@
- xo-server-auth-saml minor
- xo-server-transport-email major
- xo-server-transport-slack patch
- xo-web patch

<!--packages-end-->
13 changes: 12 additions & 1 deletion packages/xo-web/src/common/xo/index.js
Original file line number Diff line number Diff line change
@@ -359,7 +359,18 @@ export const subscribeRemotes = createSubscription(() => _call('remote.getAll'))

export const subscribeRemotesInfo = createSubscription(() => _call('remote.getAllInfo'))

export const subscribeProxies = createSubscription(() => _call('proxy.getAll'))
export const subscribeProxies = createSubscription(async () => {
const { user } = store.getState()
if (user != null && user.permission !== 'admin') {
return
}

try {
return await _call('proxy.getAll')
} catch (e) {
console.log('Error when subscribing to proxies : ', e)
}
})

export const subscribeResourceSets = createSubscription(() => _call('resourceSet.getAll'))

0 comments on commit bef5174

Please sign in to comment.