Browse Source

Do not publish the whole user doc of board members (#579)

The user document contains hashed passwords and hashed resume tokens.
We should only publish the required bits.
Alexander Sulfrian 9 năm trước cách đây
mục cha
commit
abc58e7482
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      server/publications/boards.js

+ 5 - 1
server/publications/boards.js

@@ -105,7 +105,11 @@ Meteor.publishRelations('board', function(boardId) {
     //
     //
     this.cursor(Users.find({
     this.cursor(Users.find({
       _id: { $in: _.pluck(board.members, 'userId') },
       _id: { $in: _.pluck(board.members, 'userId') },
-    }), function(userId) {
+    }, { fields: {
+      'username': 1,
+      'profile.fullname': 1,
+      'profile.avatarUrl': 1,
+    }}), function(userId) {
       // Presence indicators
       // Presence indicators
       this.cursor(presences.find({ userId }));
       this.cursor(presences.find({ userId }));
     });
     });