Skip to content

Commit

Permalink
ACL List changes
Browse files Browse the repository at this point in the history
  • Loading branch information
RobAndrewHurst committed Mar 8, 2024
1 parent 05667a4 commit ba6526b
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions mod/user/list.js
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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.')
Expand Down

0 comments on commit ba6526b

Please sign in to comment.