Commit ccf91da0aab8839e7cb2b085d7fe9be2e7bc82d8
1 parent
6763b1f12b
Exists in
master
add allow/deny rules to Documents collection
Closes #149
Showing
1 changed file
with
12 additions
and
0 deletions
Show diff stats
imports/api/documents/documents.js
1 | import faker from 'faker'; | 1 | import faker from 'faker'; |
2 | import { Mongo } from 'meteor/mongo'; | 2 | import { Mongo } from 'meteor/mongo'; |
3 | import { SimpleSchema } from 'meteor/aldeed:simple-schema'; | 3 | import { SimpleSchema } from 'meteor/aldeed:simple-schema'; |
4 | import { Factory } from 'meteor/dburles:factory'; | 4 | import { Factory } from 'meteor/dburles:factory'; |
5 | 5 | ||
6 | export const Documents = new Mongo.Collection('Documents'); | 6 | export const Documents = new Mongo.Collection('Documents'); |
7 | 7 | ||
8 | Documents.allow({ | ||
9 | insert: () => false, | ||
10 | update: () => false, | ||
11 | remove: () => false, | ||
12 | }); | ||
13 | |||
14 | Documents.deny({ | ||
15 | insert: () => true, | ||
16 | update: () => true, | ||
17 | remove: () => true, | ||
18 | }); | ||
19 | |||
8 | Documents.schema = new SimpleSchema({ | 20 | Documents.schema = new SimpleSchema({ |
9 | title: { | 21 | title: { |
10 | type: String, | 22 | type: String, |
11 | label: 'The title of the document.', | 23 | label: 'The title of the document.', |
12 | }, | 24 | }, |
13 | }); | 25 | }); |
14 | 26 | ||
15 | Documents.attachSchema(Documents.schema); | 27 | Documents.attachSchema(Documents.schema); |
16 | 28 | ||
17 | Factory.define('document', Documents, { | 29 | Factory.define('document', Documents, { |
18 | title: () => faker.hacker.phrase(), | 30 | title: () => faker.hacker.phrase(), |
19 | }); | 31 | }); |
20 | 32 |