1package access23import "context"45// ContextKey is the context key for the access level.6var ContextKey = &struct{ string }{"access"}78// FromContext returns the access level from the context.9func FromContext(ctx context.Context) AccessLevel {10 if ac, ok := ctx.Value(ContextKey).(AccessLevel); ok {11 return ac12 }1314 return -115}1617// WithContext returns a new context with the access level.18func WithContext(ctx context.Context, ac AccessLevel) context.Context {19 return context.WithValue(ctx, ContextKey, ac)20}