Documentation ¶
Index ¶
- type ReqContext
- func (ctx *ReqContext) Handle(cfg *setting.Cfg, status int, title string, err error)
- func (ctx *ReqContext) HasHelpFlag(flag user.HelpFlags1) bool
- func (ctx *ReqContext) HasUserRole(role org.RoleType) bool
- func (ctx *ReqContext) IsApiRequest() bool
- func (ctx *ReqContext) IsPublicDashboardView() bool
- func (ctx *ReqContext) JsonApiErr(status int, message string, err error)
- func (ctx *ReqContext) QueryBoolWithDefault(field string, d bool) bool
- func (ctx *ReqContext) TimeRequest(timer prometheus.Summary)
- func (ctx *ReqContext) WriteErr(err error)
- func (ctx *ReqContext) WriteErrOrFallback(status int, message string, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReqContext ¶
type ReqContext struct { *web.Context *user.SignedInUser UserToken *usertoken.UserToken IsSignedIn bool IsRenderCall bool AllowAnonymous bool SkipDSCache bool SkipQueryCache bool Logger log.Logger Error error // RequestNonce is a cryptographic request identifier for use with Content Security Policy. RequestNonce string PublicDashboardAccessToken string PerfmonTimer prometheus.Summary LookupTokenErr error }
func (*ReqContext) HasHelpFlag ¶
func (ctx *ReqContext) HasHelpFlag(flag user.HelpFlags1) bool
func (*ReqContext) HasUserRole ¶
func (ctx *ReqContext) HasUserRole(role org.RoleType) bool
func (*ReqContext) IsApiRequest ¶
func (ctx *ReqContext) IsApiRequest() bool
func (*ReqContext) IsPublicDashboardView ¶
func (ctx *ReqContext) IsPublicDashboardView() bool
func (*ReqContext) JsonApiErr ¶
func (ctx *ReqContext) JsonApiErr(status int, message string, err error)
func (*ReqContext) QueryBoolWithDefault ¶
func (ctx *ReqContext) QueryBoolWithDefault(field string, d bool) bool
QueryBoolWithDefault extracts a value from the request query params and applies a bool default if not present.
func (*ReqContext) TimeRequest ¶
func (ctx *ReqContext) TimeRequest(timer prometheus.Summary)
func (*ReqContext) WriteErr ¶
func (ctx *ReqContext) WriteErr(err error)
WriteErr writes an error response based on errutil.Error. If provided error is not errutil.Error a 500 response is written.
func (*ReqContext) WriteErrOrFallback ¶
func (ctx *ReqContext) WriteErrOrFallback(status int, message string, err error)
WriteErrOrFallback uses the information in an errutil.Error if available and otherwise falls back to the status and message provided as arguments.
Click to show internal directories.
Click to hide internal directories.