mirror of
https://github.com/atlanticbiomedical/biomedjs.git
synced 2025-07-02 00:47:26 -04:00
Initial Commit
This commit is contained in:
25
app/controllers/users.js
Normal file
25
app/controllers/users.js
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
var mongoose = require('mongoose'),
|
||||
User = mongoose.model('User');
|
||||
|
||||
exports.index = function(req, res) {
|
||||
var criteria = { deleted: false };
|
||||
|
||||
if (req.query.group) {
|
||||
criteria.groups = req.query.group;
|
||||
}
|
||||
|
||||
if (req.query.perms) {
|
||||
criteria.perms = req.query.perms;
|
||||
}
|
||||
|
||||
var query = User.find(criteria)
|
||||
.select('name groups')
|
||||
.exec(function(err, results) {
|
||||
if (err) {
|
||||
res.json(500, err);
|
||||
} else {
|
||||
res.json(results);
|
||||
}
|
||||
});
|
||||
};
|
Reference in New Issue
Block a user