mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Add user service method SetUsingOrg and GetSignedInUserWithCacheCtx (#53343)
* Chore: Add user service method SetUsingOrg * Chore: Add user service method GetSignedInUserWithCacheCtx * Use method GetSignedInUserWithCacheCtx from user service * Fix lint after rebase * Fix lint * Fix lint error * roll back some changes * Roll back changes in api and middleware * Add xorm tags to SignedInUser ID fields
This commit is contained in:
@@ -27,8 +27,8 @@ type ConfigSrv struct {
|
||||
}
|
||||
|
||||
func (srv ConfigSrv) RouteGetAlertmanagers(c *models.ReqContext) response.Response {
|
||||
urls := srv.alertmanagerProvider.AlertmanagersFor(c.OrgId)
|
||||
droppedURLs := srv.alertmanagerProvider.DroppedAlertmanagersFor(c.OrgId)
|
||||
urls := srv.alertmanagerProvider.AlertmanagersFor(c.OrgID)
|
||||
droppedURLs := srv.alertmanagerProvider.DroppedAlertmanagersFor(c.OrgID)
|
||||
ams := v1.AlertManagersResult{Active: make([]v1.AlertManager, len(urls)), Dropped: make([]v1.AlertManager, len(droppedURLs))}
|
||||
for i, url := range urls {
|
||||
ams.Active[i].URL = url.String()
|
||||
@@ -48,7 +48,7 @@ func (srv ConfigSrv) RouteGetNGalertConfig(c *models.ReqContext) response.Respon
|
||||
return accessForbiddenResp()
|
||||
}
|
||||
|
||||
cfg, err := srv.store.GetAdminConfiguration(c.OrgId)
|
||||
cfg, err := srv.store.GetAdminConfiguration(c.OrgID)
|
||||
if err != nil {
|
||||
if errors.Is(err, store.ErrNoAdminConfiguration) {
|
||||
return ErrResp(http.StatusNotFound, err, "")
|
||||
@@ -76,7 +76,7 @@ func (srv ConfigSrv) RoutePostNGalertConfig(c *models.ReqContext, body apimodels
|
||||
return response.Error(400, "Invalid alertmanager choice specified", err)
|
||||
}
|
||||
|
||||
externalAlertmanagers, err := srv.externalAlertmanagers(c.Req.Context(), c.OrgId)
|
||||
externalAlertmanagers, err := srv.externalAlertmanagers(c.Req.Context(), c.OrgID)
|
||||
if err != nil {
|
||||
return response.Error(500, "Couldn't fetch the external Alertmanagers from datasources", err)
|
||||
}
|
||||
@@ -89,7 +89,7 @@ func (srv ConfigSrv) RoutePostNGalertConfig(c *models.ReqContext, body apimodels
|
||||
cfg := &ngmodels.AdminConfiguration{
|
||||
Alertmanagers: body.Alertmanagers,
|
||||
SendAlertsTo: sendAlertsTo,
|
||||
OrgID: c.OrgId,
|
||||
OrgID: c.OrgID,
|
||||
}
|
||||
|
||||
if err := cfg.Validate(); err != nil {
|
||||
@@ -113,7 +113,7 @@ func (srv ConfigSrv) RouteDeleteNGalertConfig(c *models.ReqContext) response.Res
|
||||
return accessForbiddenResp()
|
||||
}
|
||||
|
||||
err := srv.store.DeleteAdminConfiguration(c.OrgId)
|
||||
err := srv.store.DeleteAdminConfiguration(c.OrgID)
|
||||
if err != nil {
|
||||
srv.log.Error("unable to delete configuration", "err", err)
|
||||
return ErrResp(http.StatusInternalServerError, err, "")
|
||||
|
||||
Reference in New Issue
Block a user