summaryrefslogtreecommitdiff
path: root/src/store/modules/AccessControl/LocalUserMangementStore.js
diff options
context:
space:
mode:
authorDerick Montague <derick.montague@ibm.com>2020-10-22 00:20:00 +0300
committerDerick Montague <derick.montague@ibm.com>2020-11-03 19:47:51 +0300
commit602e98aa32f82fd3b0c3d250c7cc1f8da971db24 (patch)
tree2894194868ff987718a8b19f112b8106d662aa83 /src/store/modules/AccessControl/LocalUserMangementStore.js
parent47165201c79b3d2c4ccc62a49a9c75d038ee8fe6 (diff)
downloadwebui-vue-602e98aa32f82fd3b0c3d250c7cc1f8da971db24.tar.xz
Update linting packages to use latest
- 99% of changes were small syntax changes that were changed by the lint command. There were a couple of small manual changes to meet the property order patterns established as part of the vue:recommended guidelines. There are rules that were set from errors to warnings and new stories are being opened to address those issues. Testing: - Successfully ran npm run serve - Successfully ran npm run lint - Verified functionality works as expected, e.g. success and failure use cases - Resolved any JavaScript errors thrown to the console Signed-off-by: Derick Montague <derick.montague@ibm.com> Change-Id: Ie082f31c73ccbe8a60afa8f88a9ef6dbf33d9fd2
Diffstat (limited to 'src/store/modules/AccessControl/LocalUserMangementStore.js')
-rw-r--r--src/store/modules/AccessControl/LocalUserMangementStore.js64
1 files changed, 33 insertions, 31 deletions
diff --git a/src/store/modules/AccessControl/LocalUserMangementStore.js b/src/store/modules/AccessControl/LocalUserMangementStore.js
index e9de3cc1..6bc6ec5d 100644
--- a/src/store/modules/AccessControl/LocalUserMangementStore.js
+++ b/src/store/modules/AccessControl/LocalUserMangementStore.js
@@ -9,7 +9,7 @@ const LocalUserManagementStore = {
accountLockoutDuration: null,
accountLockoutThreshold: null,
accountMinPasswordLength: null,
- accountMaxPasswordLength: null
+ accountMaxPasswordLength: null,
},
getters: {
allUsers(state) {
@@ -21,15 +21,15 @@ const LocalUserManagementStore = {
accountSettings(state) {
return {
lockoutDuration: state.accountLockoutDuration,
- lockoutThreshold: state.accountLockoutThreshold
+ lockoutThreshold: state.accountLockoutThreshold,
};
},
accountPasswordRequirements(state) {
return {
minLength: state.accountMinPasswordLength,
- maxLength: state.accountMaxPasswordLength
+ maxLength: state.accountMaxPasswordLength,
};
- }
+ },
},
mutations: {
setUsers(state, allUsers) {
@@ -49,19 +49,21 @@ const LocalUserManagementStore = {
},
setAccountMaxPasswordLength(state, maxPasswordLength) {
state.accountMaxPasswordLength = maxPasswordLength;
- }
+ },
},
actions: {
async getUsers({ commit }) {
return await api
.get('/redfish/v1/AccountService/Accounts')
- .then(response => response.data.Members.map(user => user['@odata.id']))
- .then(userIds => api.all(userIds.map(user => api.get(user))))
- .then(users => {
- const userData = users.map(user => user.data);
+ .then((response) =>
+ response.data.Members.map((user) => user['@odata.id'])
+ )
+ .then((userIds) => api.all(userIds.map((user) => api.get(user))))
+ .then((users) => {
+ const userData = users.map((user) => user.data);
commit('setUsers', userData);
})
- .catch(error => {
+ .catch((error) => {
console.log(error);
const message = i18n.t(
'pageLocalUserManagement.toast.errorLoadUsers'
@@ -78,7 +80,7 @@ const LocalUserManagementStore = {
commit('setAccountMinPasswordLength', data.MinPasswordLength);
commit('setAccountMaxPasswordLength', data.MaxPasswordLength);
})
- .catch(error => {
+ .catch((error) => {
console.log(error);
const message = i18n.t(
'pageLocalUserManagement.toast.errorLoadAccountSettings'
@@ -90,29 +92,29 @@ const LocalUserManagementStore = {
api
.get('/redfish/v1/AccountService/Roles')
.then(({ data: { Members = [] } = {} }) => {
- const roles = Members.map(role => {
+ const roles = Members.map((role) => {
return role['@odata.id'].split('/').pop();
});
commit('setAccountRoles', roles);
})
- .catch(error => console.log(error));
+ .catch((error) => console.log(error));
},
async createUser({ dispatch }, { username, password, privilege, status }) {
const data = {
UserName: username,
Password: password,
RoleId: privilege,
- Enabled: status
+ Enabled: status,
};
return await api
.post('/redfish/v1/AccountService/Accounts', data)
.then(() => dispatch('getUsers'))
.then(() =>
i18n.t('pageLocalUserManagement.toast.successCreateUser', {
- username
+ username,
})
)
- .catch(error => {
+ .catch((error) => {
console.log(error);
const message = i18n.t(
'pageLocalUserManagement.toast.errorCreateUser',
@@ -136,10 +138,10 @@ const LocalUserManagementStore = {
.then(() => dispatch('getUsers'))
.then(() =>
i18n.t('pageLocalUserManagement.toast.successUpdateUser', {
- username: originalUsername
+ username: originalUsername,
})
)
- .catch(error => {
+ .catch((error) => {
console.log(error);
const message = i18n.t(
'pageLocalUserManagement.toast.errorUpdateUser',
@@ -154,10 +156,10 @@ const LocalUserManagementStore = {
.then(() => dispatch('getUsers'))
.then(() =>
i18n.t('pageLocalUserManagement.toast.successDeleteUser', {
- username
+ username,
})
)
- .catch(error => {
+ .catch((error) => {
console.log(error);
const message = i18n.t(
'pageLocalUserManagement.toast.errorDeleteUser',
@@ -170,14 +172,14 @@ const LocalUserManagementStore = {
const promises = users.map(({ username }) => {
return api
.delete(`/redfish/v1/AccountService/Accounts/${username}`)
- .catch(error => {
+ .catch((error) => {
console.log(error);
return error;
});
});
return await api
.all(promises)
- .then(response => {
+ .then((response) => {
dispatch('getUsers');
return response;
})
@@ -208,19 +210,19 @@ const LocalUserManagementStore = {
},
async enableUsers({ dispatch }, users) {
const data = {
- Enabled: true
+ Enabled: true,
};
const promises = users.map(({ username }) => {
return api
.patch(`/redfish/v1/AccountService/Accounts/${username}`, data)
- .catch(error => {
+ .catch((error) => {
console.log(error);
return error;
});
});
return await api
.all(promises)
- .then(response => {
+ .then((response) => {
dispatch('getUsers');
return response;
})
@@ -251,19 +253,19 @@ const LocalUserManagementStore = {
},
async disableUsers({ dispatch }, users) {
const data = {
- Enabled: false
+ Enabled: false,
};
const promises = users.map(({ username }) => {
return api
.patch(`/redfish/v1/AccountService/Accounts/${username}`, data)
- .catch(error => {
+ .catch((error) => {
console.log(error);
return error;
});
});
return await api
.all(promises)
- .then(response => {
+ .then((response) => {
dispatch('getUsers');
return response;
})
@@ -309,15 +311,15 @@ const LocalUserManagementStore = {
//GET new settings to update view
.then(() => dispatch('getAccountSettings'))
.then(() => i18n.t('pageLocalUserManagement.toast.successSaveSettings'))
- .catch(error => {
+ .catch((error) => {
console.log(error);
const message = i18n.t(
'pageLocalUserManagement.toast.errorSaveSettings'
);
throw new Error(message);
});
- }
- }
+ },
+ },
};
export default LocalUserManagementStore;