when adding/removing users from groups don't touch counters if LDAP

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
Arthur Schiwon 2019-10-15 18:19:23 +02:00
parent b41e3f8f08
commit 72a8703627
No known key found for this signature in database
GPG Key ID: 7424F1874854DF23
1 changed files with 10 additions and 8 deletions

View File

@ -98,7 +98,7 @@ const mutations = {
let group = state.groups.find(groupSearch => groupSearch.id === gid)
let user = state.users.find(user => user.id === userid)
// increase count if user is enabled
if (group && user.enabled) {
if (group && user.enabled && state.userCount > 0) {
group.usercount++
}
let groups = user.groups
@ -109,7 +109,7 @@ const mutations = {
let group = state.groups.find(groupSearch => groupSearch.id === gid)
let user = state.users.find(user => user.id === userid)
// lower count if user is enabled
if (group && user.enabled) {
if (group && user.enabled && state.userCount > 0) {
group.usercount--
}
let groups = user.groups
@ -135,12 +135,14 @@ const mutations = {
let user = state.users.find(user => user.id === userid)
user.enabled = enabled
// increment or not
state.groups.find(group => group.id === 'disabled').usercount += enabled ? -1 : 1
state.userCount += enabled ? 1 : -1
user.groups.forEach(group => {
// Increment disabled count
state.groups.find(groupSearch => groupSearch.id === group).disabled += enabled ? -1 : 1
})
if (state.userCount > 0) {
state.groups.find(group => group.id === 'disabled').usercount += enabled ? -1 : 1
state.userCount += enabled ? 1 : -1
user.groups.forEach(group => {
// Increment disabled count
state.groups.find(groupSearch => groupSearch.id === group).disabled += enabled ? -1 : 1
})
}
},
setUserData(state, { userid, key, value }) {
if (key === 'quota') {