From 1b8bada3b73bcf78cf8c1385d44bca5036a78617 Mon Sep 17 00:00:00 2001 From: Dennis Eriksen Date: Mon, 13 May 2013 10:53:00 +0200 Subject: edited the checkAccess function --- models/Access.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'models/Access.js') diff --git a/models/Access.js b/models/Access.js index ee62911..3c29a36 100644 --- a/models/Access.js +++ b/models/Access.js @@ -40,16 +40,15 @@ AccessSchema.statics = { * * @param {ObjectId} user * @param {ObjectId} project - * @return {Boolean} - * @api public + * @param {Function} callback + * @api private */ - checkAccess: function(user, project) { + checkAccess: function(user, project, callback) { console.log('inni checkAccess!') - this.findOne({ user: user }).where('project').equals(project).exec(function(err, access) { - if (err || !access) return false; - else return true; - }); + this.findOne({ user: user }) + .where('project').equals(project) + .exec(callback); } } -- cgit v1.2.3