From 98575e330a0f256549d26c3d65c9ffc9ca19a55f Mon Sep 17 00:00:00 2001 From: Nishanthi Dasanayaka Date: Wed, 28 Feb 2024 10:19:00 +1000 Subject: [PATCH] [UPDATED]-Added ipp-admin role to config file --- src/components/Navbar.vue | 4 +++- src/components/PsCalculatorDialog.vue | 3 ++- src/components/SdcCalculatorDialog.vue | 3 ++- src/components/SettingsDialog.vue | 5 +++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/components/Navbar.vue b/src/components/Navbar.vue index ea1fa54..6380462 100644 --- a/src/components/Navbar.vue +++ b/src/components/Navbar.vue @@ -242,7 +242,9 @@ return this.$keycloak && this.$keycloak.idTokenParsed ? this.$keycloak.idTokenParsed.email : '' }, is_admin: function() { - return this.$keycloak.hasRealmRole("admin") + let admin = Vue.prototype.$Config.keycloak.admin + console.log(admin) + return this.$keycloak.hasRealmRole(admin) } }, methods: { diff --git a/src/components/PsCalculatorDialog.vue b/src/components/PsCalculatorDialog.vue index 935c633..d4d0b44 100644 --- a/src/components/PsCalculatorDialog.vue +++ b/src/components/PsCalculatorDialog.vue @@ -307,7 +307,8 @@ return resultArray }, is_admin: function() { - return this.$keycloak.hasRealmRole("admin") + let admin = Vue.prototype.$Config.keycloak.admin + return this.$keycloak.hasRealmRole(admin) }, diff --git a/src/components/SdcCalculatorDialog.vue b/src/components/SdcCalculatorDialog.vue index df82aa5..27ab344 100644 --- a/src/components/SdcCalculatorDialog.vue +++ b/src/components/SdcCalculatorDialog.vue @@ -317,7 +317,8 @@ return this.$keycloak && this.$keycloak.idTokenParsed ? this.$keycloak.idTokenParsed.email : '' }, is_admin: function() { - return this.$keycloak.hasRealmRole("admin") + let admin = Vue.prototype.$Config.keycloak.admin + return this.$keycloak.hasRealmRole(admin) }, spdmodels() { diff --git a/src/components/SettingsDialog.vue b/src/components/SettingsDialog.vue index 4dcd994..11b677c 100644 --- a/src/components/SettingsDialog.vue +++ b/src/components/SettingsDialog.vue @@ -116,7 +116,8 @@ return this.$keycloak && this.$keycloak.idTokenParsed ? this.$keycloak.idTokenParsed.preferred_username : '' }, is_admin: function() { - return this.$keycloak.hasRealmRole("admin") + let admin = Vue.prototype.$Config.keycloak.admin + return this.$keycloak.hasRealmRole(admin) }, }, methods: { @@ -154,7 +155,7 @@ } // save if(this.isglobal) { - this.dbrecord.username = "admin" + this.dbrecord.username = Vue.prototype.$Config.keycloak.admin } else { this.dbrecord.username = this.username }