PublicDashboards: Variables refactor (#73476)
Co-authored-by: Juan Cabanas <juan.cabanas@grafana.com> Co-authored-by: Ezequiel Victorero <ezequiel.victorero@grafana.com> Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
co-authored by
Juan Cabanas
Ezequiel Victorero
Ryan McKinley
parent
2245a3d0d1
commit
3ee26df41e
@@ -30,8 +30,8 @@ type ReqContext struct {
|
||||
Logger log.Logger
|
||||
Error error
|
||||
// RequestNonce is a cryptographic request identifier for use with Content Security Policy.
|
||||
RequestNonce string
|
||||
IsPublicDashboardView bool
|
||||
RequestNonce string
|
||||
PublicDashboardAccessToken string
|
||||
|
||||
PerfmonTimer prometheus.Summary
|
||||
LookupTokenErr error
|
||||
@@ -60,6 +60,10 @@ func (ctx *ReqContext) IsApiRequest() bool {
|
||||
return strings.HasPrefix(ctx.Req.URL.Path, "/api")
|
||||
}
|
||||
|
||||
func (ctx *ReqContext) IsPublicDashboardView() bool {
|
||||
return ctx.PublicDashboardAccessToken != ""
|
||||
}
|
||||
|
||||
func (ctx *ReqContext) JsonApiErr(status int, message string, err error) {
|
||||
resp := make(map[string]interface{})
|
||||
traceID := tracing.TraceIDFromContext(ctx.Req.Context(), false)
|
||||
|
||||
Reference in New Issue
Block a user