Skip to content

Instantly share code, notes, and snippets.

@mariusa

mariusa/api-users.js

Last active Feb 9, 2020
Embed
What would you like to do?
NodeX code sample: Back-end API for reading users list in Manage staff
//limit to users with 'Administrator' permission
app.get('/api/staff', Common.ensureAuthenticated('Administrator'), async (req, res) => {
let dbres = await dbquery(
`SELECT id, title, first_name, last_name, name, email, phone, role, permissions, last_signin_date
FROM users WHERE org_id=? ORDER BY role, first_name`,
[req.user.org_id]
)
res.json(dbres.rows)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.