diff options
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/users.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/server/models/users.js b/server/models/users.js index 355d991bd..367c206ab 100644 --- a/server/models/users.js +++ b/server/models/users.js | |||
@@ -34,8 +34,10 @@ const Users = { | |||
34 | createUser: createUser, | 34 | createUser: createUser, |
35 | getAccessToken: getAccessToken, | 35 | getAccessToken: getAccessToken, |
36 | getClient: getClient, | 36 | getClient: getClient, |
37 | getClients: getClients, | ||
37 | getRefreshToken: getRefreshToken, | 38 | getRefreshToken: getRefreshToken, |
38 | getUser: getUser, | 39 | getUser: getUser, |
40 | getUsers: getUsers, | ||
39 | saveToken: saveToken | 41 | saveToken: saveToken |
40 | } | 42 | } |
41 | 43 | ||
@@ -70,6 +72,10 @@ function getClient (clientId, clientSecret) { | |||
70 | return OAuthClientsDB.findOne({ _id: mongo_id, clientSecret: clientSecret }) | 72 | return OAuthClientsDB.findOne({ _id: mongo_id, clientSecret: clientSecret }) |
71 | } | 73 | } |
72 | 74 | ||
75 | function getClients (callback) { | ||
76 | return OAuthClientsDB.find(callback) | ||
77 | } | ||
78 | |||
73 | function getRefreshToken (refreshToken) { | 79 | function getRefreshToken (refreshToken) { |
74 | logger.debug('Getting RefreshToken (refreshToken: ' + refreshToken + ').') | 80 | logger.debug('Getting RefreshToken (refreshToken: ' + refreshToken + ').') |
75 | 81 | ||
@@ -81,6 +87,10 @@ function getUser (username, password) { | |||
81 | return UsersDB.findOne({ username: username, password: password }) | 87 | return UsersDB.findOne({ username: username, password: password }) |
82 | } | 88 | } |
83 | 89 | ||
90 | function getUsers (callback) { | ||
91 | return UsersDB.find(callback) | ||
92 | } | ||
93 | |||
84 | function saveToken (token, client, user) { | 94 | function saveToken (token, client, user) { |
85 | logger.debug('Saving token for client ' + client.id + ' and user ' + user.id + '.') | 95 | logger.debug('Saving token for client ' + client.id + ' and user ' + user.id + '.') |
86 | 96 | ||