Forráskód Böngészése

Commit 11.8: Only publish tasks the user is allowed to see.

Frederic G. MARAND 8 éve
szülő
commit
f1819e3461
1 módosított fájl, 6 hozzáadás és 1 törlés
  1. 6 1
      simple-todos.js

+ 6 - 1
simple-todos.js

@@ -2,7 +2,12 @@ Tasks = new Mongo.Collection("tasks");
 
 
 if (Meteor.isServer) {
 if (Meteor.isServer) {
   Meteor.publish('tasks', function () {
   Meteor.publish('tasks', function () {
-    var ret = Tasks.find();
+    var ret = Tasks.find({
+      $or: [
+        { private: { $ne: true }},
+        { owner: this.userId }
+      ]
+    });
     return ret;
     return ret;
   })
   })
 }
 }