Dashboards: Don't set dashboard creator/updater if the action is done by an API key (#87704)

don't parse userID if entity isn't user or service account
This commit is contained in:
Ieva
2024-05-14 17:02:03 +01:00
committed by GitHub
parent b382cea9c8
commit 4b24019bae
@@ -236,13 +236,14 @@ func resolveUserID(user identity.Requester, log log.Logger) (int64, error) {
namespaceID, identifier := user.GetNamespacedID()
if namespaceID != identity.NamespaceUser && namespaceID != identity.NamespaceServiceAccount {
log.Debug("User does not belong to a user or service account namespace", "namespaceID", namespaceID, "userID", identifier)
} else {
var err error
userID, err = identity.IntIdentifier(namespaceID, identifier)
if err != nil {
log.Debug("failed to parse user ID", "namespaceID", namespaceID, "userID", identifier, "error", err)
}
}
userID, err := identity.IntIdentifier(namespaceID, identifier)
if err != nil {
log.Debug("failed to parse user ID", "namespaceID", namespaceID, "userID", identifier, "error", err)
}
return userID, nil
}