diff options
Diffstat (limited to 'models')
-rw-r--r-- | models/Access.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/models/Access.js b/models/Access.js index bde5b4a..9302339 100644 --- a/models/Access.js +++ b/models/Access.js @@ -48,21 +48,25 @@ AccessSchema.statics = { }, - /** + /** * Check to see if user has access to a particular project * * @param {ObjectId} user * @param {ObjectId} project + * @param {Number} permissisons * @param {Function} callback * @api private */ - checkAccess: function(user, project, callback) { - console.log('inni checkAccess!') + checkAccess: function(user, project, permissions, callback) { + if (typeof(permissions) === 'undefined') permissions = 0; + console.log('inni checkPermissions!') this.findOne({ user: user }) .where('project').equals(project) + .where('permissions').gte(permissions) .exec(callback); } + } mongoose.model('Access', AccessSchema); |