aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/users.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/users.js')
-rw-r--r--server/models/users.js10
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
75function getClients (callback) {
76 return OAuthClientsDB.find(callback)
77}
78
73function getRefreshToken (refreshToken) { 79function 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
90function getUsers (callback) {
91 return UsersDB.find(callback)
92}
93
84function saveToken (token, client, user) { 94function 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