Explorar o código

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

Frederic G. MARAND %!s(int64=8) %!d(string=hai) anos
pai
achega
f1819e3461
Modificáronse 1 ficheiros con 6 adicións e 1 borrados
  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;
   })
 }