Commit 233ab5f7f1719fbf7ce566fef3a1475c24d943e7
Exists in
master
Merge branch 'refactor/allow_deny_rules'
Showing
2 changed files
Show diff stats
collections/example.js
1 | Example = new Meteor.Collection('example'); | 1 | Example = new Meteor.Collection('example'); |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Allow | 4 | * Allow |
5 | */ | 5 | */ |
6 | 6 | ||
7 | Example.allow({ | 7 | Example.allow({ |
8 | insert: function(userId, doc){ | 8 | insert: function(){ |
9 | // Add your rules here. | 9 | // Disallow inserts on the client by default. |
10 | return false; | ||
10 | }, | 11 | }, |
11 | update: function(userId, doc, fields, modifier){ | 12 | update: function(){ |
12 | // Add your rules here. | 13 | // Disallow updates on the client by default. |
14 | return false; | ||
13 | }, | 15 | }, |
14 | remove: function(userId, doc){ | 16 | remove: function(){ |
15 | // Add your rules here. | 17 | // Disallow removes on the client by default. |
18 | return false; | ||
16 | } | 19 | } |
17 | }); | 20 | }); |
18 | 21 | ||
19 | /* | 22 | /* |
20 | * Deny | 23 | * Deny |
21 | */ | 24 | */ |
22 | 25 | ||
23 | Example.deny({ | 26 | Example.deny({ |
24 | insert: function(userId, doc){ | 27 | insert: function(){ |
25 | // Add your rules here. | 28 | // Deny inserts on the client by default. |
29 | return true; | ||
26 | }, | 30 | }, |
27 | update: function(userId, doc, fields, modifier){ | 31 | update: function(){ |
28 | // Add your rules here. | 32 | // Deny updates on the client by default. |
33 | return true; | ||
29 | }, | 34 | }, |
30 | remove: function(userId, doc){ | 35 | remove: function(){ |
31 | // Add your rules here. | 36 | // Deny removes on the client by default. |
37 | return true; | ||
32 | } | 38 | } |
33 | }); | 39 | }); |
34 | 40 |
collections/users.js
File was created | 1 | /* | |
2 | * Allow | ||
3 | */ | ||
4 | |||
5 | Meteor.users.allow({ | ||
6 | insert: function(){ | ||
7 | // Disallow user inserts on the client by default. | ||
8 | return false; | ||
9 | }, | ||
10 | update: function(){ | ||
11 | // Disallow user updates on the client by default. | ||
12 | return false; | ||
13 | }, | ||
14 | remove: function(){ | ||
15 | // Disallow user removes on the client by default. | ||
16 | return false; | ||
17 | } | ||
18 | }); | ||
19 | |||
20 | /* | ||
21 | * Deny | ||
22 | */ | ||
23 | |||
24 | Meteor.users.deny({ | ||
25 | insert: function(){ | ||
26 | // Deny user inserts on the client by default. | ||
27 | return true; | ||
28 | }, | ||
29 | update: function(){ | ||
30 | // Deny user updates on the client by default. | ||
31 | return true; | ||
32 | }, | ||
33 | remove: function(){ | ||
34 | // Deny user removes on the client by default. | ||
35 | return true; | ||
36 | } | ||
37 | }); | ||
38 |