aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/models/Access.js
diff options
context:
space:
mode:
authorDennis Eriksen <dennis.se@gmail.com>2013-05-24 09:49:59 +0200
committerDennis Eriksen <dennis.se@gmail.com>2013-05-24 09:49:59 +0200
commitf2763fe7cf38a8ee09df4878e9b0d10212c5dc58 (patch)
treece160d3a550f2e906cd381580f675c14d6c38f63 /models/Access.js
parentfixed recent activity (diff)
downloadDivid-f2763fe7cf38a8ee09df4878e9b0d10212c5dc58.tar.gz
made method to collect all users from a bunch of projects at the same time
Diffstat (limited to 'models/Access.js')
-rw-r--r--models/Access.js17
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
*