mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/yunionio/cloudpods.git
synced 2026-09-20 08:03:53 +08:00
fix: remove apiversion param from session
This commit is contained in:
@@ -151,7 +151,7 @@ func (h *AuthHandlers) GetRegionsResponse(ctx context.Context, w http.ResponseWr
|
||||
EncryptPasswd: true,
|
||||
}
|
||||
|
||||
s := auth.GetAdminSession(ctx, regions[0], "")
|
||||
s := auth.GetAdminSession(ctx, regions[0])
|
||||
if options.Options.ReturnFullDomainList {
|
||||
filters := jsonutils.NewDict()
|
||||
if len(currentDomain) > 0 {
|
||||
@@ -228,7 +228,7 @@ func (h *AuthHandlers) getUser(ctx context.Context, w http.ResponseWriter, req *
|
||||
|
||||
func getStatsInfo(ctx context.Context, req *http.Request) (jsonutils.JSONObject, error) {
|
||||
token := AppContextToken(ctx)
|
||||
s := auth.GetSession(ctx, token, FetchRegion(req), "")
|
||||
s := auth.GetSession(ctx, token, FetchRegion(req))
|
||||
params, _ := jsonutils.ParseQueryString(req.URL.RawQuery)
|
||||
|
||||
if params == nil {
|
||||
@@ -306,7 +306,7 @@ func doTenantLogin(ctx context.Context, req *http.Request, body jsonutils.JSONOb
|
||||
}
|
||||
|
||||
func fetchUserInfoFromToken(ctx context.Context, req *http.Request, token mcclient.TokenCredential) (jsonutils.JSONObject, error) {
|
||||
s := auth.GetAdminSession(ctx, FetchRegion(req), "")
|
||||
s := auth.GetAdminSession(ctx, FetchRegion(req))
|
||||
return fetchUserInfoById(s, token.GetUserId())
|
||||
}
|
||||
|
||||
@@ -383,7 +383,7 @@ func (h *AuthHandlers) doCredentialLogin(ctx context.Context, req *http.Request,
|
||||
}
|
||||
uname := token.GetUserName()
|
||||
if len(tenant) > 0 {
|
||||
s := auth.GetAdminSession(ctx, FetchRegion(req), "")
|
||||
s := auth.GetAdminSession(ctx, FetchRegion(req))
|
||||
jsonProj, e := modules.Projects.GetById(s, tenant, nil)
|
||||
if e != nil {
|
||||
log.Errorf("fail to find preset project %s, reset to empty", tenant)
|
||||
@@ -430,7 +430,7 @@ func (h *AuthHandlers) doCredentialLogin(ctx context.Context, req *http.Request,
|
||||
}
|
||||
}
|
||||
if len(tenant) == 0 {
|
||||
s := auth.GetAdminSession(ctx, FetchRegion(req), "")
|
||||
s := auth.GetAdminSession(ctx, FetchRegion(req))
|
||||
projects, e := modules.UsersV3.GetProjects(s, token.GetUserId())
|
||||
if e == nil && len(projects.Data) > 0 {
|
||||
projectJson := projects.Data[0]
|
||||
@@ -584,7 +584,7 @@ func (h *AuthHandlers) doLogin(ctx context.Context, w http.ResponseWriter, req *
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
s := auth.GetAdminSession(ctx, FetchRegion(req), "")
|
||||
s := auth.GetAdminSession(ctx, FetchRegion(req))
|
||||
isTotpInit, err := isUserTotpCredInitialed(s, token.GetUserId())
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -844,7 +844,7 @@ func isHostAgentExists(s *mcclient.ClientSession) (bool, error) {
|
||||
|
||||
func getUserInfo(ctx context.Context, req *http.Request) (*jsonutils.JSONDict, error) {
|
||||
token := AppContextToken(ctx)
|
||||
s := auth.GetAdminSession(ctx, FetchRegion(req), "")
|
||||
s := auth.GetAdminSession(ctx, FetchRegion(req))
|
||||
/*log.Infof("getUserInfo modules.UsersV3.Get")
|
||||
usr, err := modules.UsersV3.Get(s, token.GetUserId(), nil)
|
||||
if err != nil {
|
||||
@@ -1117,7 +1117,7 @@ func (h *AuthHandlers) doCreatePolicies(ctx context.Context, w http.ResponseWrit
|
||||
httperrors.InvalidInputError(ctx, w, "request body is empty")
|
||||
return
|
||||
}
|
||||
s := auth.GetSession(ctx, t, FetchRegion(req), "")
|
||||
s := auth.GetSession(ctx, t, FetchRegion(req))
|
||||
result, err := policytool.PolicyCreate(s, body)
|
||||
if err != nil {
|
||||
httperrors.GeneralServerError(ctx, w, err)
|
||||
@@ -1137,7 +1137,7 @@ func (h *AuthHandlers) doPatchPolicy(ctx context.Context, w http.ResponseWriter,
|
||||
httperrors.InvalidInputError(ctx, w, "request body is empty")
|
||||
return
|
||||
}
|
||||
s := auth.GetSession(ctx, t, FetchRegion(req), "")
|
||||
s := auth.GetSession(ctx, t, FetchRegion(req))
|
||||
result, err := policytool.PolicyPatch(s, params["<policy_id>"], body)
|
||||
if err != nil {
|
||||
httperrors.GeneralServerError(ctx, w, err)
|
||||
@@ -1153,7 +1153,7 @@ func (h *AuthHandlers) doDeletePolicies(ctx context.Context, w http.ResponseWrit
|
||||
// return
|
||||
// }
|
||||
_, query, _ := appsrv.FetchEnv(ctx, w, req)
|
||||
s := auth.GetSession(ctx, t, FetchRegion(req), "")
|
||||
s := auth.GetSession(ctx, t, FetchRegion(req))
|
||||
|
||||
idlist, e := query.GetArray("id")
|
||||
if e != nil || len(idlist) == 0 {
|
||||
@@ -1245,7 +1245,7 @@ func (h *AuthHandlers) resetUserPassword(ctx context.Context, w http.ResponseWri
|
||||
return
|
||||
}
|
||||
|
||||
s := auth.GetAdminSession(ctx, FetchRegion(req), "")
|
||||
s := auth.GetAdminSession(ctx, FetchRegion(req))
|
||||
// 2.如果已开启MFA,验证 随机密码正确
|
||||
if isMfaEnabled(user) {
|
||||
err = authToken.VerifyTotpPasscode(s, t.GetUserId(), input.Passcode)
|
||||
|
||||
Reference in New Issue
Block a user