summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkirankumarb07 <kirankumarb@ami.com>2023-03-29 08:49:31 +0300
committerSivaprabu Ganesan <sivaprabug@ami.com>2023-05-10 23:50:31 +0300
commit2dabfc1bb488f84ec00f19a51aba144b7f71e45d (patch)
tree726107029941fcb61c0d204c33945aa3c2e44ef2 /src
parent0f6147ca2518bd7401e94e5551322a7892e27d77 (diff)
downloadwebui-vue-2dabfc1bb488f84ec00f19a51aba144b7f71e45d.tar.xz
Add session timeout in Policies page
This patchset will provide the option to configure the session timeout for the WebUI. The functionality will provide the below timeout options to configure. 1. 30 minutes 2. 1 hour 3. 2 hours 4. 4 hours 5. 8 hours 6. 1 Day For the API, redfish is having the following resource. URL - /redfish/v1/SessionService Method - GET (to get the configured timeout) - PATCH (to configure the timeout value) Property - { "SessionTimeout": 1800 } When the user idles up until the configured session timeout, after that any API call from this session will get 401 status and the web UI will gets logged out. Change-Id: Ic7c6b4817e560ca4ceb983dc5e2af51f3ae08cf5 Signed-off-by: Kirankumar Ballapalli <kirankumarb@ami.com>
Diffstat (limited to 'src')
-rw-r--r--src/locales/en-US.json16
-rw-r--r--src/locales/ru-RU.json16
-rw-r--r--src/store/modules/SecurityAndAccess/PoliciesStore.js29
-rw-r--r--src/views/SecurityAndAccess/Policies/Policies.vue50
4 files changed, 107 insertions, 4 deletions
diff --git a/src/locales/en-US.json b/src/locales/en-US.json
index d3319935..ff988225 100644
--- a/src/locales/en-US.json
+++ b/src/locales/en-US.json
@@ -801,6 +801,7 @@
"errorSshEnabled": "Error enabling SSH security setting.",
"errorVtpmDisabled": "Error disabling VirtualTPM security setting.",
"errorVtpmEnabled": "Error enabling VirtualTPM security setting.",
+ "errorSessionTimeout": "Error configuring session timeout.",
"successIpmiDisabled": "Successfully disabled IPMI security setting.",
"successIpmiEnabled": "Successfully enabled IPMI security setting.",
"successRtadDisabled": "Successfully disabled RTAD security setting.",
@@ -808,10 +809,21 @@
"successSshDisabled": "Successfully disabled SSH security setting.",
"successSshEnabled": "Successfully enabled SSH security setting.",
"successVtpmDisabled": "Successfully disabled VirtualTPM security setting.",
- "successVtpmEnabled": "Successfully enabled VirtualTPM security setting."
+ "successVtpmEnabled": "Successfully enabled VirtualTPM security setting.",
+ "successSessionTimeout": "Successfully configured the session timeout."
+ },
+ "options": {
+ "30minutes": "30 Minutes",
+ "1hour": "1 Hour",
+ "2hours": "2 Hours",
+ "4hours": "4 Hours",
+ "8hours": "8 Hours",
+ "1day": "1 Day"
},
"vtpm": "VirtualTPM",
- "vtpmDescription": "Enabling vTPM makes a TPM available to the guest operating system."
+ "vtpmDescription": "Enabling vTPM makes a TPM available to the guest operating system.",
+ "webSessionTimeOut": "WEB Session Timeout",
+ "webSessionTimeOutDescription": "Change the Web session timeout in given options"
},
"pagePower": {
"description": "Set a power cap to keep power consumption at or below the specified value in watts",
diff --git a/src/locales/ru-RU.json b/src/locales/ru-RU.json
index 3ff0e6a2..15e23a54 100644
--- a/src/locales/ru-RU.json
+++ b/src/locales/ru-RU.json
@@ -799,6 +799,7 @@
"errorSshEnabled": "Ошибка включения настроек безопасности SSH.",
"errorVtpmDisabled": "Ошибка отключения настроек безопасности VirtualTPM.",
"errorVtpmEnabled": "Ошибка включения настроек безопасности VirtualTPM.",
+ "errorSessionTimeout": "Ошибка настройки таймаута сессии.",
"successIpmiDisabled": "Успешное отключение настроек безопасности IPMI.",
"successIpmiEnabled": "Успешное включение настроек безопасности IPMI.",
"successRtadDisabled": "Успешное отключение настроек безопасности RTAD.",
@@ -806,10 +807,21 @@
"successSshDisabled": "Успешное отключение настроек безопасности SSH.",
"successSshEnabled": "Успешное включение настроек безопасности SSH.",
"successVtpmDisabled": "Успешное отключение настроек безопасности VirtualTPM.",
- "successVtpmEnabled": "Успешное включение настроек безопасности VirtualTPM."
+ "successVtpmEnabled": "Успешное включение настроек безопасности VirtualTPM.",
+ "successSessionTimeout": "Успешная настройка таймаута сессии."
+ },
+ "options": {
+ "30minutes": "30 минут",
+ "1hour": "1 час",
+ "2hours": "2 часа",
+ "4hours": "4 часа",
+ "8hours": "8 часов",
+ "1day": "1 день"
},
"vtpm": "VirtualTPM",
- "vtpmDescription": "Включение vTPM делает TPM доступным для гостевой операционной системы."
+ "vtpmDescription": "Включение vTPM делает TPM доступным для гостевой операционной системы.",
+ "webSessionTimeOut": "Таймаут интернет-сессии",
+ "webSessionTimeOutDescription": "Изменение таймаута интернет-сессии"
},
"pagePower": {
"description": "Задайте порог мощности, чтобы ограничить потребление питания не превышающее заданное значение в Ваттах",
diff --git a/src/store/modules/SecurityAndAccess/PoliciesStore.js b/src/store/modules/SecurityAndAccess/PoliciesStore.js
index 64bd3369..e6bcfb96 100644
--- a/src/store/modules/SecurityAndAccess/PoliciesStore.js
+++ b/src/store/modules/SecurityAndAccess/PoliciesStore.js
@@ -8,12 +8,14 @@ const PoliciesStore = {
ipmiProtocolEnabled: false,
rtadEnabled: 'Disabled',
vtpmEnabled: 'Disabled',
+ sessionTimeoutValue: null,
},
getters: {
sshProtocolEnabled: (state) => state.sshProtocolEnabled,
ipmiProtocolEnabled: (state) => state.ipmiProtocolEnabled,
rtadEnabled: (state) => state.rtadEnabled,
vtpmEnabled: (state) => state.vtpmEnabled,
+ getSessionTimeoutValue: (state) => state.sessionTimeoutValue,
},
mutations: {
setSshProtocolEnabled: (state, sshProtocolEnabled) =>
@@ -22,6 +24,9 @@ const PoliciesStore = {
(state.ipmiProtocolEnabled = ipmiProtocolEnabled),
setRtadEnabled: (state, rtadEnabled) => (state.rtadEnabled = rtadEnabled),
setVtpmEnabled: (state, vtpmEnabled) => (state.vtpmEnabled = vtpmEnabled),
+ setSessionTimeoutValue(state, sessionTimeoutValue) {
+ state.sessionTimeoutValue = sessionTimeoutValue;
+ },
},
actions: {
async getNetworkProtocolStatus({ commit }) {
@@ -44,6 +49,15 @@ const PoliciesStore = {
})
.catch((error) => console.log(error));
},
+ async getSessionTimeout({ commit }) {
+ return await api
+ .get('/redfish/v1/SessionService')
+ .then((response) => {
+ const sessionTimeoutValue = response.data.SessionTimeout;
+ commit('setSessionTimeoutValue', sessionTimeoutValue);
+ })
+ .catch((error) => console.log(error));
+ },
async saveIpmiProtocolState({ commit }, protocolEnabled) {
commit('setIpmiProtocolEnabled', protocolEnabled);
const ipmi = {
@@ -144,6 +158,21 @@ const PoliciesStore = {
}
});
},
+ async saveSessionTimeoutValue({ dispatch }, sessionTimeoutNewValue) {
+ const sessionValue = {
+ SessionTimeout: sessionTimeoutNewValue,
+ };
+ return await api
+ .patch('/redfish/v1/SessionService', sessionValue)
+ .then(() => dispatch('getSessionTimeout'))
+ .then(() => {
+ return i18n.t('pagePolicies.toast.successSessionTimeout');
+ })
+ .catch((error) => {
+ console.log(error);
+ throw new Error(i18n.t('pagePolicies.toast.errorSessionTimeout'));
+ });
+ },
},
};
diff --git a/src/views/SecurityAndAccess/Policies/Policies.vue b/src/views/SecurityAndAccess/Policies/Policies.vue
index 1dc197c7..3ebfee4e 100644
--- a/src/views/SecurityAndAccess/Policies/Policies.vue
+++ b/src/views/SecurityAndAccess/Policies/Policies.vue
@@ -103,6 +103,30 @@
</b-form-checkbox>
</b-col>
</b-row>
+ <b-row class="setting-section">
+ <b-col class="d-flex align-items-center justify-content-between">
+ <dl class="mt-3 mr-3 w-75">
+ <dt>{{ $t('pagePolicies.webSessionTimeOut') }}</dt>
+ <dd>
+ {{ $t('pagePolicies.webSessionTimeOutDescription') }}
+ </dd>
+ </dl>
+ </b-col>
+ <b-col lg="3" class="session-timeout">
+ <b-form-select
+ id="session-timeout-options"
+ v-model="sessionTimeoutState"
+ :options="sessionTimeOutOptions"
+ @change="saveSessionTimeoutValue"
+ >
+ <template #first>
+ <b-form-select-option :value="null" disabled>
+ {{ $t('global.form.selectAnOption') }}
+ </b-form-select-option>
+ </template>
+ </b-form-select>
+ </b-col>
+ </b-row>
</b-col>
</b-row>
</b-container>
@@ -126,6 +150,14 @@ export default {
return {
modifySSHPolicyDisabled:
process.env.VUE_APP_MODIFY_SSH_POLICY_DISABLED === 'true',
+ sessionTimeOutOptions: [
+ { value: 1800, text: this.$t('pagePolicies.options.30minutes') },
+ { value: 3600, text: this.$t('pagePolicies.options.1hour') },
+ { value: 7200, text: this.$t('pagePolicies.options.2hours') },
+ { value: 14400, text: this.$t('pagePolicies.options.4hours') },
+ { value: 28800, text: this.$t('pagePolicies.options.8hours') },
+ { value: 86400, text: this.$t('pagePolicies.options.1day') },
+ ],
};
},
computed: {
@@ -169,12 +201,21 @@ export default {
return newValue;
},
},
+ sessionTimeoutState: {
+ get() {
+ return this.$store.getters['policies/getSessionTimeoutValue'];
+ },
+ set(newValue) {
+ return newValue;
+ },
+ },
},
created() {
this.startLoader();
Promise.all([
this.$store.dispatch('policies/getBiosStatus'),
this.$store.dispatch('policies/getNetworkProtocolStatus'),
+ this.$store.dispatch('policies/getSessionTimeout'),
]).finally(() => this.endLoader());
},
methods: {
@@ -202,6 +243,12 @@ export default {
.then((message) => this.successToast(message))
.catch(({ message }) => this.errorToast(message));
},
+ saveSessionTimeoutValue(sessionTimeoutState) {
+ this.$store
+ .dispatch('policies/saveSessionTimeoutValue', sessionTimeoutState)
+ .then((message) => this.successToast(message))
+ .catch(({ message }) => this.errorToast(message));
+ },
},
};
</script>
@@ -210,4 +257,7 @@ export default {
.setting-section {
border-bottom: 1px solid gray('300');
}
+.session-timeout {
+ align-self: center;
+}
</style>