fleet/server/test/context.go

14 lines
345 B
Go
Raw Normal View History

package test
import (
"context"
2021-06-26 04:46:51 +00:00
"github.com/fleetdm/fleet/v4/server/contexts/viewer"
"github.com/fleetdm/fleet/v4/server/fleet"
)
// UserContext returns a new context with the provided user as the viewer.
func UserContext(ctx context.Context, user *fleet.User) context.Context {
return viewer.NewContext(ctx, viewer.Viewer{User: user})
}