Browse Source

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

Frederic G. MARAND 8 years ago
parent
commit
f1819e3461
1 changed files with 6 additions and 1 deletions
  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;
   })
 }