mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-13 22:49:51 -04:00
Fixed #29.
This commit is contained in:
parent
5e30ab091b
commit
05fed5f79b
1 changed files with 3 additions and 2 deletions
|
@ -136,8 +136,9 @@ module.exports = class Handler
|
|||
# Keeping it simple for now and just allowing access to the first FETCH_LIMIT results.
|
||||
query = {'original': mongoose.Types.ObjectId(id)}
|
||||
sort = {'created': -1}
|
||||
selectString = 'slug name version commitMessage created permissions' # Is this even working?
|
||||
@modelClass.find(query).select(selectString).limit(FETCH_LIMIT).sort(sort).exec (err, results) =>
|
||||
selectString = 'slug name version commitMessage created permissions'
|
||||
aggregate = $match: query
|
||||
@modelClass.aggregate(aggregate).project(selectString).limit(FETCH_LIMIT).sort(sort).exec (err, results) =>
|
||||
return @sendDatabaseError(res, err) if err
|
||||
for doc in results
|
||||
return @sendUnauthorizedError(res) unless @hasAccessToDocument(req, doc)
|
||||
|
|
Loading…
Reference in a new issue