aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/users.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/users.js')
-rw-r--r--server/controllers/api/users.js18
1 files changed, 2 insertions, 16 deletions
diff --git a/server/controllers/api/users.js b/server/controllers/api/users.js
index 53bf56790..6cd0e84f7 100644
--- a/server/controllers/api/users.js
+++ b/server/controllers/api/users.js
@@ -6,6 +6,7 @@ const waterfall = require('async/waterfall')
6const constants = require('../../initializers/constants') 6const constants = require('../../initializers/constants')
7const db = require('../../initializers/database') 7const db = require('../../initializers/database')
8const logger = require('../../helpers/logger') 8const logger = require('../../helpers/logger')
9const utils = require('../../helpers/utils')
9const middlewares = require('../../middlewares') 10const middlewares = require('../../middlewares')
10const admin = middlewares.admin 11const admin = middlewares.admin
11const oAuth = middlewares.oauth 12const oAuth = middlewares.oauth
@@ -82,7 +83,7 @@ function listUsers (req, res, next) {
82 db.User.listForApi(req.query.start, req.query.count, req.query.sort, function (err, usersList, usersTotal) { 83 db.User.listForApi(req.query.start, req.query.count, req.query.sort, function (err, usersList, usersTotal) {
83 if (err) return next(err) 84 if (err) return next(err)
84 85
85 res.json(getFormatedUsers(usersList, usersTotal)) 86 res.json(utils.getFormatedObjects(usersList, usersTotal))
86 }) 87 })
87} 88}
88 89
@@ -121,18 +122,3 @@ function updateUser (req, res, next) {
121function success (req, res, next) { 122function success (req, res, next) {
122 res.end() 123 res.end()
123} 124}
124
125// ---------------------------------------------------------------------------
126
127function getFormatedUsers (users, usersTotal) {
128 const formatedUsers = []
129
130 users.forEach(function (user) {
131 formatedUsers.push(user.toFormatedJSON())
132 })
133
134 return {
135 total: usersTotal,
136 data: formatedUsers
137 }
138}