Fix getting a document by slug or id and projecting it without its permissions

This commit is contained in:
Scott Erickson 2016-02-22 09:30:36 -08:00
parent cac9a7463f
commit 9f3b177574

View file

@ -214,6 +214,7 @@ module.exports = class Handler
if req.query.project
projection = {}
projection[field] = 1 for field in req.query.project.split(',')
projection.permissions = 1 # TODO: A better solution for always including properties the server needs
@getDocumentForIdOrSlug id, projection, (err, document) =>
return @sendDatabaseError(res, err) if err
return @sendNotFoundError(res) unless document?