From 1ca5c13841979506e6f97f7845793f3b52292fa4 Mon Sep 17 00:00:00 2001 From: Dennis Eriksen Date: Thu, 23 May 2013 13:42:27 +0200 Subject: added loadProject, to load all project participants --- models/Access.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/models/Access.js b/models/Access.js index 9302339..ab45b4c 100644 --- a/models/Access.js +++ b/models/Access.js @@ -48,7 +48,22 @@ AccessSchema.statics = { }, - /** + /** + * Load all users associated with a project + * + * @param {ObjectId} project + * @param {Function} callback + * @api private + */ + + loadProject: function(project, callback) { + this.find({ project: project }) + .populate('user') + .sort({ 'created': 1 }) // sort by date + .exec(callback); + }, + + /** * Check to see if user has access to a particular project * * @param {ObjectId} user -- cgit v1.2.3