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:
idafurjes
2022-08-11 13:28:55 +02:00
committed by GitHub
parent ca72cd570e
commit a14621fff6
191 changed files with 1108 additions and 1049 deletions
+5 -5
View File
@@ -169,7 +169,7 @@ func (hs *thumbService) parseImageReq(c *models.ReqContext, checkSave bool) *pre
}
req := &previewRequest{
OrgID: c.OrgId,
OrgID: c.OrgID,
UID: params[":uid"],
Theme: theme,
Kind: kind,
@@ -432,8 +432,8 @@ func (hs *thumbService) StartCrawler(c *models.ReqContext) response.Response {
}
go hs.runOnDemandCrawl(context.Background(), cmd.Theme, cmd.Mode, models.ThumbnailKindDefault, rendering.AuthOpts{
OrgID: c.OrgId,
UserID: c.UserId,
OrgID: c.OrgID,
UserID: c.UserID,
OrgRole: c.OrgRole,
})
@@ -468,7 +468,7 @@ func (hs *thumbService) getStatus(c *models.ReqContext, uid string, checkSave bo
return 404
}
guardian := guardian.New(c.Req.Context(), dashboardID, c.OrgId, c.SignedInUser)
guardian := guardian.New(c.Req.Context(), dashboardID, c.OrgID, c.SignedInUser)
if checkSave {
if canSave, err := guardian.CanSave(); err != nil || !canSave {
return 403 // forbidden
@@ -484,7 +484,7 @@ func (hs *thumbService) getStatus(c *models.ReqContext, uid string, checkSave bo
}
func (hs *thumbService) getDashboardId(c *models.ReqContext, uid string) (int64, error) {
query := models.GetDashboardQuery{Uid: uid, OrgId: c.OrgId}
query := models.GetDashboardQuery{Uid: uid, OrgId: c.OrgID}
if err := hs.dashboardService.GetDashboard(c.Req.Context(), &query); err != nil {
return 0, err