List
List
operation executes hook methods in the following sequence:
Hook | Parameters | Description |
---|---|---|
docPermissions |
|
|
decorate |
|
|
decorateAll |
|
|
Configuration Example
modelRouter.docPermissions('list', function (docOrObject, globalPermissions) {
const isMe = String(docOrObject._id) === String(this.user._id);
return {
canEdit: globalPermissions.isAdmin || isMe,
};
});
modelRouter.decorate('list', function (docObject, globalPermissions) {
docObject.decoratedBy = 'egose';
return docObject;
});
modelRouter.decorateAll(function (docObjects, globalPermissions) {
const filtered = docObjects.filter((doc) => doc.public);
return filtered;
});