LDAP: Fix active sync with large quantities of users (#73834)

This commit is contained in:
Gabriel MABILLE 2023-08-25 16:10:48 +02:00 committed by GitHub
parent 4ce8fff98a
commit 9e52414a91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -3,6 +3,7 @@ package sync
import (
"context"
"errors"
"fmt"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/services/authn"
@ -234,7 +235,7 @@ func (s *UserSync) updateUserAttributes(ctx context.Context, usr *user.User, id
}
if needsUpdate {
s.log.FromContext(ctx).Debug("Syncing user info", "id", id.ID, "update", updateCmd)
s.log.FromContext(ctx).Debug("Syncing user info", "id", id.ID, "update", fmt.Sprintf("%v", updateCmd))
if err := s.userService.Update(ctx, updateCmd); err != nil {
return err
}

View File

@ -288,8 +288,8 @@ func (server *Server) Users(logins []string) (
) {
var users [][]*ldap.Entry
err := getUsersIteration(logins, func(previous, current int) error {
var err error
users, err = server.users(logins[previous:current])
iterationUsers, err := server.users(logins[previous:current])
users = append(users, iterationUsers...)
return err
})
if err != nil {