NGAlerting: Use identity.Requester interface instead of SignedInUser (#76360)

* unfurl SignedInUserAttrs services

* replace signedInUser with Requester

replace signedInUser with requester

* fix tests

* linting

---------

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
This commit is contained in:
Jo
2023-11-14 15:47:34 +01:00
committed by GitHub
parent ab4fc07cc7
commit 580477bf8e
19 changed files with 87 additions and 72 deletions

View File

@@ -44,7 +44,7 @@ func (srv ConfigSrv) RouteGetAlertmanagers(c *contextmodel.ReqContext) response.
}
func (srv ConfigSrv) RouteGetNGalertConfig(c *contextmodel.ReqContext) response.Response {
if c.OrgRole != org.RoleAdmin {
if c.SignedInUser.GetOrgRole() != org.RoleAdmin {
return accessForbiddenResp()
}
@@ -66,7 +66,7 @@ func (srv ConfigSrv) RouteGetNGalertConfig(c *contextmodel.ReqContext) response.
}
func (srv ConfigSrv) RoutePostNGalertConfig(c *contextmodel.ReqContext, body apimodels.PostableNGalertConfig) response.Response {
if c.OrgRole != org.RoleAdmin {
if c.SignedInUser.GetOrgRole() != org.RoleAdmin {
return accessForbiddenResp()
}
@@ -100,7 +100,7 @@ func (srv ConfigSrv) RoutePostNGalertConfig(c *contextmodel.ReqContext, body api
}
func (srv ConfigSrv) RouteDeleteNGalertConfig(c *contextmodel.ReqContext) response.Response {
if c.OrgRole != org.RoleAdmin {
if c.SignedInUser.GetOrgRole() != org.RoleAdmin {
return accessForbiddenResp()
}