新增接口清除除参数token外这个人的token
This commit is contained in:
@@ -448,3 +448,14 @@ func DisableUser(userID, operatorUserName string) (err error) {
|
||||
func GetUserBindAuthInfo(userID string) (authList []*model.AuthBind, err error) {
|
||||
return dao.GetUserBindAuthInfo(dao.GetDB(), userID, model.AuthBindTypeAuth, nil, "", "", "")
|
||||
}
|
||||
|
||||
func DeletedTokenInfoWithoutParam(authInfo *AuthInfo) (err error) {
|
||||
userID := authInfo.UserID
|
||||
tokens, err := api.Cacher.Keys("TOKEN.V2." + userID + "*")
|
||||
for _, v := range tokens {
|
||||
if authInfo.Token != v {
|
||||
RemoveUserInfo(v)
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -306,3 +306,19 @@ func (c *Auth2Controller) ChangePassword() {
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 清除除参数token以外的这个人的token
|
||||
// @Description 清除除参数token以外的这个人的token
|
||||
// @Param token header string true "认证token"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /DeletedTokenInfoWithoutParam [put]
|
||||
func (c *Auth2Controller) DeletedTokenInfoWithoutParam() {
|
||||
c.callDeletedTokenInfoWithoutParam(func(params *tAuth2DeletedTokenInfoWithoutParamParams) (retVal interface{}, errCode string, err error) {
|
||||
newAuthInfo, err2 := auth2.GetTokenInfo(params.Token)
|
||||
if err = err2; err == nil {
|
||||
err = auth2.DeletedTokenInfoWithoutParam(newAuthInfo)
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
@@ -133,6 +133,15 @@ func init() {
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:Auth2Controller"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:Auth2Controller"],
|
||||
beego.ControllerComments{
|
||||
Method: "DeletedTokenInfoWithoutParam",
|
||||
Router: `/DeletedTokenInfoWithoutParam`,
|
||||
AllowHTTPMethods: []string{"put"},
|
||||
MethodParams: param.Make(),
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:Auth2Controller"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:Auth2Controller"],
|
||||
beego.ControllerComments{
|
||||
Method: "DingDingOAuth2",
|
||||
@@ -1309,7 +1318,7 @@ func init() {
|
||||
beego.ControllerComments{
|
||||
Method: "CreateUpcSkuByExcel",
|
||||
Router: `/CreateUpcSkuByExcel`,
|
||||
AllowHTTPMethods: []string{"post","get"},
|
||||
AllowHTTPMethods: []string{"post"},
|
||||
MethodParams: param.Make(),
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
Reference in New Issue
Block a user