aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/oauth-token.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/oauth-token.js')
-rw-r--r--server/models/oauth-token.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/server/models/oauth-token.js b/server/models/oauth-token.js
index f6a814c36..d53fdcf31 100644
--- a/server/models/oauth-token.js
+++ b/server/models/oauth-token.js
@@ -20,7 +20,8 @@ OAuthTokenSchema.path('user').required(true)
20OAuthTokenSchema.statics = { 20OAuthTokenSchema.statics = {
21 getByRefreshTokenAndPopulateClient: getByRefreshTokenAndPopulateClient, 21 getByRefreshTokenAndPopulateClient: getByRefreshTokenAndPopulateClient,
22 getByTokenAndPopulateUser: getByTokenAndPopulateUser, 22 getByTokenAndPopulateUser: getByTokenAndPopulateUser,
23 getByRefreshToken: getByRefreshToken 23 getByRefreshToken: getByRefreshToken,
24 removeByUserId: removeByUserId
24} 25}
25 26
26mongoose.model('OAuthToken', OAuthTokenSchema) 27mongoose.model('OAuthToken', OAuthTokenSchema)
@@ -53,3 +54,7 @@ function getByTokenAndPopulateUser (bearerToken) {
53function getByRefreshToken (refreshToken) { 54function getByRefreshToken (refreshToken) {
54 return this.findOne({ refreshToken: refreshToken }).exec() 55 return this.findOne({ refreshToken: refreshToken }).exec()
55} 56}
57
58function removeByUserId (userId, callback) {
59 return this.remove({ user: userId }, callback)
60}