新增接口清除除参数token外这个人的token

This commit is contained in:
苏尹岚
2020-04-13 10:30:24 +08:00
parent 81d63e1741
commit 11cdb8828d
3 changed files with 37 additions and 1 deletions

View File

@@ -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
}