Closed isAlmogK closed 9 years ago
The auth
function should do the trick for the roles and filters
would be the obvious solution for specific data. That being said, I was unable to properly implement subscription.userId
to authenticate said users. I resorted to filtering my data before its published via Meteor.Pagination.prototype.publish
. I would love to get @alethes input on this because I have a itchy feeling that I am missing something obvious. Furthermore, did @alethes previous reply not work?
Pages = new Meteor.Pagination("organizationsUsers", {
auth: function() {
var organization = Organizations.find({userId: this.userId}).fetch();
var usersArray = _.flatten(_.pluck(organization, "users"), true);
return Meteor.users.find({_id: {$in: usersArray}}); // ,{fields: {email: 0, services:0, account:0}}
}
});
Because this is model I followed after various attempts to no avail. I wish I could give you more insight but I coffee and myself mix as well as water and oil.
This should work just fine:
Pages = new Meteor.Pagination("organizationsUsers", {
auth: function(skip, sub) {
var organization = Organizations.find({userId: sub.userId}).fetch();
var usersArray = _.flatten(_.pluck(organization, "users"), true);
return Meteor.users.find({_id: {$in: usersArray}}); // ,{fields: {email: 0, services:0, account:0}}
}
});
Otherwise, please reopen.
I wanted to know hoe publications are handled is this done via the package? What if I want to publish a collection based on specific data or user role?