Переглянути джерело

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

Frederic G. MARAND 8 роки тому
батько
коміт
f1819e3461
1 змінених файлів з 6 додано та 1 видалено
  1. 6 1
      simple-todos.js

+ 6 - 1
simple-todos.js

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