diff options
author | Dennis Eriksen <dennis.se@gmail.com> | 2013-05-13 10:53:00 +0200 |
---|---|---|
committer | Dennis Eriksen <dennis.se@gmail.com> | 2013-05-13 10:53:00 +0200 |
commit | 1b8bada3b73bcf78cf8c1385d44bca5036a78617 (patch) | |
tree | b017dd05603996520192a25d783c745ecefbe281 /models/Access.js | |
parent | added ppost feature (diff) | |
download | Divid-1b8bada3b73bcf78cf8c1385d44bca5036a78617.tar.gz |
edited the checkAccess function
Diffstat (limited to 'models/Access.js')
-rw-r--r-- | models/Access.js | 13 |
1 files changed, 6 insertions, 7 deletions
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); } } |