meteor - Publishing different data for different users -


i'm trying publish users admins ommitting data (in case api key supposed "private" each user, realize admin can check database let's ignore security implications now).

so basic idea user can see own profile , no 1 else. admin can see own complete profile , censored version of other user's profiles. have following publish code:

meteor.publish('currentuser', function() {   return meteor.users.find({_id: this.userid}, {fields: {'profile.apikey': true}}); });  meteor.publish('allusers', function() {   var currentuser = meteor.users.findone(this.userid);   return currentuser && currentuser.profile.admin ?          meteor.users.find({}, {sort: ['username', 'asc'], fields: {'profile.apikey': false}}) : null; }); 

the problem apikey field doesn't published after logging in. ie. if login admin admin's apikey won't available until page reloaded. removing restriction 'allusers' publish function solves issue must have this. there way force meteor reload subscriptions after login?


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -