Fix getting a document by slug or id and projecting it without its permissions
This commit is contained in:
parent
cac9a7463f
commit
9f3b177574
1 changed files with 1 additions and 0 deletions
|
@ -214,6 +214,7 @@ module.exports = class Handler
|
||||||
if req.query.project
|
if req.query.project
|
||||||
projection = {}
|
projection = {}
|
||||||
projection[field] = 1 for field in req.query.project.split(',')
|
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) =>
|
@getDocumentForIdOrSlug id, projection, (err, document) =>
|
||||||
return @sendDatabaseError(res, err) if err
|
return @sendDatabaseError(res, err) if err
|
||||||
return @sendNotFoundError(res) unless document?
|
return @sendNotFoundError(res) unless document?
|
||||||
|
|
Reference in a new issue