From 63496c5ae9190bf04be2bb3ba78a89b069a7689f Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Wed, 24 Sep 2025 10:52:08 +0530 Subject: [PATCH] ui: prevent calling listConfigurations when not allowed 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 6113f3ed9406..15712986ad62 100644 --- a/ui/src/store/modules/user.js +++ b/ui/src/store/modules/user.js @@ -532,14 +532,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 c3f812773be5..76df7b246aa1 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' }