From 0e6d2d986b7022648bdb5550060aeb7b7fe76bf4 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Mon, 12 Jan 2026 13:23:37 +0530 Subject: [PATCH] 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 --- ui/src/store/modules/user.js | 18 ++++++++++-------- .../views/image/RegisterOrUploadTemplate.vue | 3 +++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/ui/src/store/modules/user.js b/ui/src/store/modules/user.js index fc1b0dc25a9..21cd603e378 100644 --- a/ui/src/store/modules/user.js +++ b/ui/src/store/modules/user.js @@ -539,14 +539,16 @@ const user = { reject(error) }) - api('listConfigurations', { name: 'hypervisor.custom.display.name' }).then(json => { - if (json.listconfigurationsresponse.configuration !== null) { - const config = json.listconfigurationsresponse.configuration[0] - commit('SET_CUSTOM_HYPERVISOR_NAME', config.value) - } - }).catch(error => { - reject(error) - }) + if ('listConfigurations' in store.getters.apis) { + api('listConfigurations', { name: 'hypervisor.custom.display.name' }).then(json => { + if (json.listconfigurationsresponse.configuration !== null) { + const config = json.listconfigurationsresponse.configuration[0] + commit('SET_CUSTOM_HYPERVISOR_NAME', config.value) + } + }).catch(error => { + reject(error) + }) + } }) }, UpdateConfiguration ({ commit }) { diff --git a/ui/src/views/image/RegisterOrUploadTemplate.vue b/ui/src/views/image/RegisterOrUploadTemplate.vue index c3f812773be..76df7b246aa 100644 --- a/ui/src/views/image/RegisterOrUploadTemplate.vue +++ b/ui/src/views/image/RegisterOrUploadTemplate.vue @@ -646,6 +646,9 @@ export default { }) }, fetchCustomHypervisorName () { + if (!('listConfigurations' in this.$store.getters.apis)) { + return + } const params = { name: 'hypervisor.custom.display.name' }