I’m trying to publish only documents that a user has access to.
The access system is outside of the document database but a function call like hasAccess(customuserID, _id) will return true if the user has access.
The problem is that publish returns a cursor so I can’t do something like:
Meteor.publish(‘theInvoices’, function () {
return Invoices.find().fetch().filter(function (doc) {
return hasAccess(customerUserID, doc._id); // external access , filter
});
});
Or course this functions returns an array of filtered documents and not a cursor so the question is how do I filter the results of query (without using database filters) before publishing the results or how do I turn an array of documents into a publishable cursor?
Thanks
Jim