Skip to content

Commit

Permalink
Remove 'autopublish, insecure' packages and add code for security rea…
Browse files Browse the repository at this point in the history
…sons.
  • Loading branch information
snize committed Jul 1, 2013
1 parent f588bcd commit 13d6a87
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
3 changes: 1 addition & 2 deletions labs/architecture-examples/meteor/.meteor/packages
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
autopublish
insecure

27 changes: 27 additions & 0 deletions labs/architecture-examples/meteor/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,33 @@ if (Meteor.is_client) {
};
}

//Publish and subscribe setting
if (Meteor.is_server) {
Meteor.publish('todos', function () {
return Todos.find();
});
}

if (Meteor.is_client) {
Meteor.subscribe('todos');
}

//Allow users to write directly to this collection from client code, subject to limitations you define.
if (Meteor.is_server) {
Todos.allow({
insert: function () {
return true;
},
update: function () {
return true;
},
remove: function () {
return true;
}
});
}

//Defines functions that can be invoked over the network by clients.
Meteor.methods({
clearCompleted: function () {
Todos.remove({completed: true});
Expand Down

0 comments on commit 13d6a87

Please sign in to comment.