AccessControl: Extend scope parameters with extra params from context (#39722)

* AccessControl: Extend scope parameters with extra params from context

Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
This commit is contained in:
Gabriel MABILLEandEmil Tullstedt authored and GitHub committed 2021-10-06 13:15:09 +02:00
1 parent d1b2b10e6a
commit 458371c8eb
6 files changed
+115 -35

No files matched your search

@@ -19,7 +19,7 @@ func Middleware(ac accesscontrol.AccessControl) func(macaron.Handler, accesscont
}
return func(c *models.ReqContext) {
injected, err := evaluator.Inject(macaron.Params(c.Req))
injected, err := evaluator.Inject(buildScopeParams(c))
if err != nil {
c.JsonApiErr(http.StatusInternalServerError, "Internal server error", err)
return
@@ -69,3 +69,10 @@ func newID() string {
}
return "ACE" + id
}
func buildScopeParams(c *models.ReqContext) accesscontrol.ScopeParams {
return accesscontrol.ScopeParams{
OrgID: c.OrgId,
URLParams: macaron.Params(c.Req),
}
}