Read
Read
operation executes hook methods in the following sequence:
Hook | Parameters | Description |
---|---|---|
docPermissions |
|
|
decorate |
|
|
Configuration Example
modelRouter.docPermissions('read', function (docOrObject, globalPermissions) {
const isMe = String(docOrObject._id) === String(this.user._id);
return {
'edit.name': globalPermissions.isAdmin || isMe,
'edit.role': globalPermissions.isAdmin,
};
});
modelRouter.decorate('read', function (docObject, globalPermissions) {
docObject.timestamp = new Date();
return docObject;
});