mirror of https://github.com/grafana/grafana.git
22 lines
426 B
Go
22 lines
426 B
Go
|
|
package legacy
|
||
|
|
|
||
|
|
import (
|
||
|
|
"context"
|
||
|
|
)
|
||
|
|
|
||
|
|
type LegacyValue struct {
|
||
|
|
DashboardID int64
|
||
|
|
}
|
||
|
|
|
||
|
|
type accessKey struct{}
|
||
|
|
|
||
|
|
// WithRequester attaches the requester to the context.
|
||
|
|
func WithLegacyAccess(ctx context.Context) context.Context {
|
||
|
|
return context.WithValue(ctx, accessKey{}, &LegacyValue{})
|
||
|
|
}
|
||
|
|
|
||
|
|
func GetLegacyAccess(ctx context.Context) *LegacyValue {
|
||
|
|
v, _ := ctx.Value(accessKey{}).(*LegacyValue)
|
||
|
|
return v // nil if missing
|
||
|
|
}
|