diff --git a/mod/user/list.js b/mod/user/list.js index 2d14889022..fc5446da56 100644 --- a/mod/user/list.js +++ b/mod/user/list.js @@ -1,11 +1,38 @@ /** +### List Users + +This module provides an endpoint to return a list of users from the ACL. + @module /user/list */ const acl = require('./acl') +/** + * > Optional Params : email + * @function export + * @param {Object} req + * @param {Object} res + * @returns {acl} acl + */ module.exports = async (req, res) => { + /** + @typedef {Object} acl + @property {string} email + @property {bool} verified + @property {bool} approved + @property {bool} admin + @property {bool} api + @property {array} roles + @property {string} language + @property {array} access_log + @property {int} failedattempts + @property {string} approved_by + @property {string} expires_on + @property {bool} blocked + @property {string} verificationtoken + */ let rows = await acl(` SELECT email, @@ -22,6 +49,7 @@ module.exports = async (req, res) => { blocked, verificationtoken FROM acl_schema.acl_table + ${req.params.email ? `WHERE email='${req.params.email}'`: ''} ORDER BY email;`) if (rows instanceof Error) return res.status(500).send('Failed to query PostGIS table.')