refactor: append, build variable and type switch (#4940)

* refactor: append, build variable and type switch

* fix: remove redundant space.
This commit is contained in:
Bo-Yi Wu
2019-05-28 23:45:54 +08:00
committed by GitHub
parent 31557b1274
commit 743697a549
8 changed files with 42 additions and 46 deletions

View File

@ -13,9 +13,7 @@ import (
"encoding/hex"
"errors"
"fmt"
// Needed for jpeg support
_ "image/jpeg"
_ "image/jpeg" // Needed for jpeg support
"image/png"
"os"
"path/filepath"
@ -1622,7 +1620,7 @@ func SyncExternalUsers() {
var sshKeysNeedUpdate bool
// Find all users with this login type
var users []User
var users []*User
x.Where("login_type = ?", LoginLDAP).
And("login_source = ?", s.ID).
Find(&users)
@ -1641,7 +1639,7 @@ func SyncExternalUsers() {
// Search for existing user
for _, du := range users {
if du.LowerName == strings.ToLower(su.Username) {
usr = &du
usr = du
break
}
}
@ -1724,7 +1722,7 @@ func SyncExternalUsers() {
log.Trace("SyncExternalUsers[%s]: Deactivating user %s", s.Name, usr.Name)
usr.IsActive = false
err = UpdateUserCols(&usr, "is_active")
err = UpdateUserCols(usr, "is_active")
if err != nil {
log.Error("SyncExternalUsers[%s]: Error deactivating user %s: %v", s.Name, usr.Name, err)
}