summaryrefslogtreecommitdiffstats
path: root/models/user.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/user.go')
-rw-r--r--models/user.go11
1 files changed, 5 insertions, 6 deletions
diff --git a/models/user.go b/models/user.go
index 8b3dd00430..51c1bb0ce1 100644
--- a/models/user.go
+++ b/models/user.go
@@ -1307,7 +1307,6 @@ func DeleteInactiveUsers(ctx context.Context, olderThan time.Duration) (err erro
Find(&users); err != nil {
return fmt.Errorf("get all inactive users: %v", err)
}
-
}
// FIXME: should only update authorized_keys file once after all deletions.
for _, u := range users {
@@ -1572,7 +1571,6 @@ type SearchUserOptions struct {
func (opts *SearchUserOptions) toConds() builder.Cond {
var cond builder.Cond = builder.Eq{"type": opts.Type}
-
if len(opts.Keyword) > 0 {
lowerKeyword := strings.ToLower(opts.Keyword)
keywordCond := builder.Or(
@@ -1601,7 +1599,8 @@ func (opts *SearchUserOptions) toConds() builder.Cond {
} else {
exprCond = builder.Expr("org_user.org_id = \"user\".id")
}
- var accessCond = builder.NewCond()
+
+ var accessCond builder.Cond
if !opts.Actor.IsRestricted {
accessCond = builder.Or(
builder.In("id", builder.Select("org_id").From("org_user").LeftJoin("`user`", exprCond).Where(builder.And(builder.Eq{"uid": opts.Actor.ID}, builder.Eq{"visibility": structs.VisibleTypePrivate}))),
@@ -1847,7 +1846,7 @@ func SyncExternalUsers(ctx context.Context, updateExisting bool) error {
log.Trace("Doing: SyncExternalUsers[%s]", s.Name)
var existingUsers []int64
- var isAttributeSSHPublicKeySet = len(strings.TrimSpace(s.LDAP().AttributeSSHPublicKey)) > 0
+ isAttributeSSHPublicKeySet := len(strings.TrimSpace(s.LDAP().AttributeSSHPublicKey)) > 0
var sshKeysNeedUpdate bool
// Find all users with this login type
@@ -2021,9 +2020,9 @@ func SyncExternalUsers(ctx context.Context, updateExisting bool) error {
// IterateUser iterate users
func IterateUser(f func(user *User) error) error {
var start int
- var batchSize = setting.Database.IterateBufferSize
+ batchSize := setting.Database.IterateBufferSize
for {
- var users = make([]*User, 0, batchSize)
+ users := make([]*User, 0, batchSize)
if err := x.Limit(batchSize, start).Find(&users); err != nil {
return err
}