diff options
author | Dennis Eriksen <dennis.se@gmail.com> | 2013-05-24 09:49:59 +0200 |
---|---|---|
committer | Dennis Eriksen <dennis.se@gmail.com> | 2013-05-24 09:49:59 +0200 |
commit | f2763fe7cf38a8ee09df4878e9b0d10212c5dc58 (patch) | |
tree | ce160d3a550f2e906cd381580f675c14d6c38f63 | |
parent | fixed recent activity (diff) | |
download | Divid-f2763fe7cf38a8ee09df4878e9b0d10212c5dc58.tar.gz |
made method to collect all users from a bunch of projects at the same time
-rw-r--r-- | models/Access.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/models/Access.js b/models/Access.js index ab45b4c..75f6003 100644 --- a/models/Access.js +++ b/models/Access.js @@ -63,6 +63,23 @@ AccessSchema.statics = { .exec(callback); }, + + /** + * Load all users associated with several projects + * + * @param {Arrau[ObjectId]} projects + * @param {Function} callback + * @api private + */ + + loadProjects: function(projects, callback) { + this.find({ project: { $in: projects } }) + .populate({ path: 'user', select: 'name email status' }) + .sort({ 'created': -1 }) + .exec(callback); + }, + + /** * Check to see if user has access to a particular project * |