func authViewer(ctx context.Context, sessionKey string, svc fleet.Service) (*viewer.Viewer, error) {
	session, err := svc.GetSessionByKey(ctx, sessionKey)
	if err != nil {
		return nil, fleet.NewAuthRequiredError(err.Error())
	}
	user, err := svc.UserUnauthorized(ctx, session.UserID)
	if err != nil {
		return nil, fleet.NewAuthRequiredError(err.Error())
	}
	return &viewer.Viewer{User: user, Session: session}, nil
}
// authViewer creates an authenticated viewer by validating the session key.
authViewer creates an authenticated viewer by validating the session key.
// authViewer creates an authenticated viewer by validating the session key .
func authViewer(ctx context.Context, sessionKey string, svc fleet.Service) (*viewer.Viewer, error) {
	session, err := svc.GetSessionByKey(ctx, sessionKey)
	if err != nil {
		return nil, fleet.NewAuthRequiredError(err.Error())
	}
	user, err := svc.UserUnauthorized(ctx, session.UserID)
	if err != nil {
		return nil, fleet.NewAuthRequiredError(err.Error())
	}
	return &viewer.Viewer{User: user, Session: session}, nil
}
func authViewer ( ctx context . Context , sessionKey string , svc fleet . Service ) ( * viewer . Viewer , error ) { session , err := svc . GetSessionByKey ( ctx , sessionKey ) if err != nil { return nil , fleet . NewAuthRequiredError ( err . Error ( ) ) } user , err := svc . UserUnauthorized ( ctx , session . UserID ) if err != nil { return nil , fleet . NewAuthRequiredError ( err . Error ( ) ) } return & viewer . Viewer { User : user , Session : session } , nil }
authViewer creates an authenticated viewer by validating the session key.
authViewer creates an authenticated viewer by validating the session key .