mirror of
https://github.com/grafana/grafana.git
synced 2025-07-30 16:52:54 +08:00

--------- Co-authored-by: Stephanie Hingtgen <stephanie.hingtgen@grafana.com> Co-authored-by: Todd Treece <360020+toddtreece@users.noreply.github.com>
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
|
|
}
|