Batch disable users (#17254)
* batch disable users * batch revoke users tokens * split batch disable user and revoke token * fix tests for batch disable users * Chore: add BatchDisableUsers() to the bus
This commit is contained in:
@@ -117,6 +117,26 @@ func TestUserAuthToken(t *testing.T) {
|
||||
So(model2, ShouldBeNil)
|
||||
})
|
||||
})
|
||||
|
||||
Convey("When revoking users tokens in a batch", func() {
|
||||
Convey("Can revoke all users tokens", func() {
|
||||
userIds := []int64{}
|
||||
for i := 0; i < 3; i++ {
|
||||
userId := userID + int64(i+1)
|
||||
userIds = append(userIds, userId)
|
||||
userAuthTokenService.CreateToken(context.Background(), userId, "192.168.10.11:1234", "some user agent")
|
||||
}
|
||||
|
||||
err := userAuthTokenService.BatchRevokeAllUserTokens(context.Background(), userIds)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
for _, v := range userIds {
|
||||
tokens, err := userAuthTokenService.GetUserTokens(context.Background(), v)
|
||||
So(err, ShouldBeNil)
|
||||
So(len(tokens), ShouldEqual, 0)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Convey("expires correctly", func() {
|
||||
|
||||
Reference in New Issue
Block a user