From 37dc07b292ae4b24011a99146150869bb9c17c65 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 21 Mar 2016 21:11:26 +0100 Subject: Create an "installer" module that create defaults clients/users... --- server/models/users.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'server/models') 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 = { createUser: createUser, getAccessToken: getAccessToken, getClient: getClient, + getClients: getClients, getRefreshToken: getRefreshToken, getUser: getUser, + getUsers: getUsers, saveToken: saveToken } @@ -70,6 +72,10 @@ function getClient (clientId, clientSecret) { return OAuthClientsDB.findOne({ _id: mongo_id, clientSecret: clientSecret }) } +function getClients (callback) { + return OAuthClientsDB.find(callback) +} + function getRefreshToken (refreshToken) { logger.debug('Getting RefreshToken (refreshToken: ' + refreshToken + ').') @@ -81,6 +87,10 @@ function getUser (username, password) { return UsersDB.findOne({ username: username, password: password }) } +function getUsers (callback) { + return UsersDB.find(callback) +} + function saveToken (token, client, user) { logger.debug('Saving token for client ' + client.id + ' and user ' + user.id + '.') -- cgit v1.2.3