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

View File

@@ -251,8 +251,8 @@ func putAdminScenario(t *testing.T, desc string, url string, routePattern string
c.Req.Body = mockRequestBody(cmd)
c.Req.Header.Add("Content-Type", "application/json")
sc.context = c
sc.context.UserId = testUserID
sc.context.OrgId = testOrgID
sc.context.UserID = testUserID
sc.context.OrgID = testOrgID
sc.context.OrgRole = role
return hs.AdminUpdateUserPermissions(c)
@@ -276,8 +276,8 @@ func adminLogoutUserScenario(t *testing.T, desc string, url string, routePattern
t.Log("Route handler invoked", "url", c.Req.URL)
sc.context = c
sc.context.UserId = testUserID
sc.context.OrgId = testOrgID
sc.context.UserID = testUserID
sc.context.OrgID = testOrgID
sc.context.OrgRole = org.RoleAdmin
return hs.AdminLogoutUser(c)
@@ -304,8 +304,8 @@ func adminRevokeUserAuthTokenScenario(t *testing.T, desc string, url string, rou
c.Req.Body = mockRequestBody(cmd)
c.Req.Header.Add("Content-Type", "application/json")
sc.context = c
sc.context.UserId = testUserID
sc.context.OrgId = testOrgID
sc.context.UserID = testUserID
sc.context.OrgID = testOrgID
sc.context.OrgRole = org.RoleAdmin
return hs.AdminRevokeUserAuthToken(c)
@@ -330,8 +330,8 @@ func adminGetUserAuthTokensScenario(t *testing.T, desc string, url string, route
sc.userAuthTokenService = fakeAuthTokenService
sc.defaultHandler = routing.Wrap(func(c *models.ReqContext) response.Response {
sc.context = c
sc.context.UserId = testUserID
sc.context.OrgId = testOrgID
sc.context.UserID = testUserID
sc.context.OrgID = testOrgID
sc.context.OrgRole = org.RoleAdmin
return hs.AdminGetUserAuthTokens(c)
@@ -360,7 +360,7 @@ func adminDisableUserScenario(t *testing.T, desc string, action string, url stri
sc.authInfoService = authInfoService
sc.defaultHandler = routing.Wrap(func(c *models.ReqContext) response.Response {
sc.context = c
sc.context.UserId = testUserID
sc.context.UserID = testUserID
if action == "enable" {
return hs.AdminEnableUser(c)
@@ -386,7 +386,7 @@ func adminDeleteUserScenario(t *testing.T, desc string, url string, routePattern
sc.authInfoService = &logintest.AuthInfoServiceFake{}
sc.defaultHandler = routing.Wrap(func(c *models.ReqContext) response.Response {
sc.context = c
sc.context.UserId = testUserID
sc.context.UserID = testUserID
return hs.AdminDeleteUser(c)
})
@@ -414,7 +414,7 @@ func adminCreateUserScenario(t *testing.T, desc string, url string, routePattern
c.Req.Body = mockRequestBody(cmd)
c.Req.Header.Add("Content-Type", "application/json")
sc.context = c
sc.context.UserId = testUserID
sc.context.UserID = testUserID
return hs.AdminCreateUser(c)
})