Files
grafana/pkg/services/live/context.go
Alexander Emelin 336bc559a3 Basic streaming plugin support (#31940)
This pull request migrates testdata to coreplugin streaming capabilities,
this is mostly a working concept of streaming plugins at the moment, 
the work will continue in the following pull requests.
2021-03-23 20:24:08 +03:00

25 lines
548 B
Go

package live
import (
"context"
"github.com/grafana/grafana/pkg/models"
)
type signedUserContextKeyType int
var signedUserContextKey signedUserContextKeyType
func setContextSignedUser(ctx context.Context, user *models.SignedInUser) context.Context {
ctx = context.WithValue(ctx, signedUserContextKey, user)
return ctx
}
func getContextSignedUser(ctx context.Context) (*models.SignedInUser, bool) {
if val := ctx.Value(signedUserContextKey); val != nil {
user, ok := val.(*models.SignedInUser)
return user, ok
}
return nil, false
}