Merge pull request #21031 from overleaf/msm-clean-collabratec-tokens

[web] cleanup collabratec tokens

GitOrigin-RevId: 0ad73ca5d4c4c82d79e2ec7119c5b77a83b7086f
This commit is contained in:
Miguel Serrano
2025-01-08 11:08:40 +01:00
committed by Copybot
parent 95c506f4a5
commit 3f6aa2369d
2 changed files with 15 additions and 0 deletions
@@ -158,4 +158,8 @@ async function _cleanupUser(user) {
await InstitutionsAPI.promises.deleteAffiliations(user._id)
await SubscriptionUpdater.promises.removeUserFromAllGroups(user._id)
await UserMembershipsHandler.promises.removeUserFromAllEntities(user._id)
await Modules.promises.hooks.fire('cleanupPersonalAccessTokens', user._id, [
'collabratec',
'git_bridge',
])
}
@@ -236,6 +236,17 @@ describe('UserDeleter', function () {
).to.have.been.calledWith(this.userId)
})
it('should cleanup collabratec access tokens', async function () {
await this.UserDeleter.promises.deleteUser(this.userId, {
ipAddress: this.ipAddress,
})
expect(this.Modules.promises.hooks.fire).to.have.been.calledWith(
'cleanupPersonalAccessTokens',
this.userId,
['collabratec', 'git_bridge']
)
})
it('should fire the deleteUser hook for modules', async function () {
await this.UserDeleter.promises.deleteUser(this.userId, {
ipAddress: this.ipAddress,