[v10.1.x] UserSync: Avoid UpdateLastSeenAt with invalid user ids (#72784)

UserSync: Avoid UpdateLastSeenAt with invalid user ids (#72776)

* avoid user zero

* more errors

* more tests

* split

(cherry picked from commit 7431c0ddb1)

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
grafana-delivery-bot[bot]
2023-08-03 09:41:22 +03:00
committed by GitHub
co-authored by Ryan McKinley
parent db44383a77
commit c30f9216b1
4 changed files with 29 additions and 3 deletions
@@ -136,9 +136,13 @@ func (s *UserSync) SyncLastSeenHook(ctx context.Context, identity *authn.Identit
namespace, id := identity.NamespacedID()
// do not sync invalid users
if id <= 0 {
return nil // skip sync
}
if namespace != authn.NamespaceUser && namespace != authn.NamespaceServiceAccount {
// skip sync
return nil
return nil // skip sync
}
go func(userID int64) {