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