diff options
Diffstat (limited to 'src')
3 files changed, 22 insertions, 1 deletions
diff --git a/src/store/modules/AccessControl/LocalUserMangementStore.js b/src/store/modules/AccessControl/LocalUserMangementStore.js index c729d15f..113b420f 100644 --- a/src/store/modules/AccessControl/LocalUserMangementStore.js +++ b/src/store/modules/AccessControl/LocalUserMangementStore.js @@ -20,6 +20,7 @@ const LocalUserManagementStore = { namespaced: true, state: { allUsers: [], + accountRoles: [], accountLockoutDuration: null, accountLockoutThreshold: null, accountMinPasswordLength: null, @@ -29,6 +30,9 @@ const LocalUserManagementStore = { allUsers(state) { return state.allUsers; }, + accountRoles(state) { + return state.accountRoles; + }, accountSettings(state) { return { lockoutDuration: state.accountLockoutDuration, @@ -46,6 +50,9 @@ const LocalUserManagementStore = { setUsers(state, allUsers) { state.allUsers = allUsers; }, + setAccountRoles(state, accountRoles) { + state.accountRoles = accountRoles; + }, setLockoutDuration(state, lockoutDuration) { state.accountLockoutDuration = lockoutDuration; }, @@ -88,6 +95,17 @@ const LocalUserManagementStore = { throw new Error('Error loading account settings.'); }); }, + getAccountRoles({ commit }) { + api + .get('/redfish/v1/AccountService/Roles') + .then(({ data: { Members = [] } = {} }) => { + const roles = Members.map(role => { + return role['@odata.id'].split('/').pop(); + }); + commit('setAccountRoles', roles); + }) + .catch(error => console.log(error)); + }, async createUser({ dispatch }, { username, password, privilege, status }) { const data = { UserName: username, diff --git a/src/views/AccessControl/LocalUserManagement/LocalUserManagement.vue b/src/views/AccessControl/LocalUserManagement/LocalUserManagement.vue index c08b39b9..b9df58f5 100644 --- a/src/views/AccessControl/LocalUserManagement/LocalUserManagement.vue +++ b/src/views/AccessControl/LocalUserManagement/LocalUserManagement.vue @@ -200,6 +200,7 @@ export default { created() { this.$store.dispatch('localUsers/getUsers'); this.$store.dispatch('localUsers/getAccountSettings'); + this.$store.dispatch('localUsers/getAccountRoles'); }, methods: { initModalUser(user) { diff --git a/src/views/AccessControl/LocalUserManagement/ModalUser.vue b/src/views/AccessControl/LocalUserManagement/ModalUser.vue index a9c0f6c5..f4a66e79 100644 --- a/src/views/AccessControl/LocalUserManagement/ModalUser.vue +++ b/src/views/AccessControl/LocalUserManagement/ModalUser.vue @@ -225,7 +225,6 @@ export default { }, data() { return { - privilegeTypes: ['Administrator', 'Operator', 'ReadOnly', 'NoAccess'], originalUsername: '', form: { status: true, @@ -246,6 +245,9 @@ export default { }, manualUnlockPolicy() { return !this.accountSettings.accountLockoutDuration; + }, + privilegeTypes() { + return this.$store.getters['localUsers/accountRoles']; } }, watch: { |