I have following code for chat application with channels:
stream.permissions.write(function(eventName, message, channelName) {
var currentUser = Meteor.users.findOne({_id : this.userId});
return _.contains(currentUser.channelsJoined, channelName) // if user joined chat - allow him to send chat stream message
}, false);
}
stream.permissions.read(function(eventName, message, channelName) {
var currentUser = Meteor.users.findOne({_id : this.userId});
return _.contains(currentUser.channelsJoined, channelName) // if user joined chat - allow him to receive chat stream message
}, false);
}
When I pass channel name in emit - write permissions sees it, however in read permissions code channelName argument is undefined. I didn't find much about this in documentation and it seems it should work like that. What I am doing wrong? Or is it a bug? Because permissions without additional parameters is pretty much useless in real world scenarios...
Hi,
I have following code for chat application with channels:
When I pass channel name in emit - write permissions sees it, however in read permissions code channelName argument is undefined. I didn't find much about this in documentation and it seems it should work like that. What I am doing wrong? Or is it a bug? Because permissions without additional parameters is pretty much useless in real world scenarios...