summaryrefslogtreecommitdiffstats
path: root/models/rules.js
blob: 271e6b52493ea3595a20d70d399ff20c438ae7fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Rules = new Mongo.Collection('rules');

Rules.attachSchema(new SimpleSchema({
  title: {
    type: String,
    optional: true,
  },
  triggerId: {
    type: String,
    optional: true,
  },
  actionId: {
    type: String,
    optional: true,
  },
}));

Rules.mutations({
  rename(description) {
    return { $set: { description } };
  },
});

Rules.helpers({
  getAction(){
    return Actions.findOne({_id:this.actionId});
  },
});



Rules.allow({
    update: function () {
    // add custom authentication code here
    return true;
  },
    remove: function () {
    // add custom authentication code here
    return true;
  },
    insert: function () {
    // add custom authentication code here
    return true;
  },
});