我有一个模板,我试图显示所有用户在被调用的userList。显示流星的所有用户
提前帮助//服务器
Meteor.publish("userList", function() {
var user = Meteor.users.findOne({
_id: this.userId
});
if (Roles.userIsInRole(user, ["admin"])) {
return Meteor.users.find({}, {
fields: {
profile_name: 1,
emails: 1,
roles: 1
}
});
}
this.stop();
return;
});
谢谢!
你可以通过'''this.userId' ''而不是'''user''例如'''if(Roles.userIsInRole(this.userId,['admin']) ){..}''' –