peerlibrary / meteor-middleware

Middleware support for Meteor publish functions
https://atmospherejs.com/peerlibrary/middleware
BSD 3-Clause "New" or "Revised" License
14 stars 1 forks source link

Add hook to add checks to run or not run the publish function at all #2

Open mitar opened 9 years ago

mitar commented 9 years ago

Currently, we just modify the publish function's output. But another common pattern is to decide to return or not the output at all, based on some permission checks. So to help code reusability, middleware could allow registering hooks which would be called to allow running the publish function, or returning empty publish instead. An allow/deny hooks could be done in similar way to Meteor allow/deny.