ui: prevent calling listConfigurations when not allowed (#11704)

By default, normal users won't have access to listConfigurations API,
therefore, UI should not call it when access is not there.

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
This commit is contained in:
Abhishek Kumar 2026-01-12 13:23:37 +05:30 committed by GitHub
parent db1c7d678c
commit 0e6d2d986b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 8 deletions

View File

@ -539,14 +539,16 @@ const user = {
reject(error) reject(error)
}) })
api('listConfigurations', { name: 'hypervisor.custom.display.name' }).then(json => { if ('listConfigurations' in store.getters.apis) {
if (json.listconfigurationsresponse.configuration !== null) { api('listConfigurations', { name: 'hypervisor.custom.display.name' }).then(json => {
const config = json.listconfigurationsresponse.configuration[0] if (json.listconfigurationsresponse.configuration !== null) {
commit('SET_CUSTOM_HYPERVISOR_NAME', config.value) const config = json.listconfigurationsresponse.configuration[0]
} commit('SET_CUSTOM_HYPERVISOR_NAME', config.value)
}).catch(error => { }
reject(error) }).catch(error => {
}) reject(error)
})
}
}) })
}, },
UpdateConfiguration ({ commit }) { UpdateConfiguration ({ commit }) {

View File

@ -646,6 +646,9 @@ export default {
}) })
}, },
fetchCustomHypervisorName () { fetchCustomHypervisorName () {
if (!('listConfigurations' in this.$store.getters.apis)) {
return
}
const params = { const params = {
name: 'hypervisor.custom.display.name' name: 'hypervisor.custom.display.name'
} }