Access Control: Get global role from request params (#84469)

This commit is contained in:
Alexander Zobnin
2024-03-14 16:17:24 +01:00
committed by GitHub
parent da66f560a5
commit f36ad469d0
+9
View File
@@ -352,6 +352,15 @@ func UseGlobalOrgFromRequestData(c *contextmodel.ReqContext) (int64, error) {
return c.SignedInUser.GetOrgID(), nil
}
// UseGlobalOrgFromRequestParams returns global org if `global` flag is set or the org where user is logged in.
func UseGlobalOrgFromRequestParams(c *contextmodel.ReqContext) (int64, error) {
if c.QueryBool("global") {
return GlobalOrgID, nil
}
return c.SignedInUser.GetOrgID(), nil
}
func getOrgQueryFromRequest(c *contextmodel.ReqContext) (*QueryWithOrg, error) {
query := &QueryWithOrg{}