rules.js 727 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. Rules = new Mongo.Collection('rules');
  2. Rules.attachSchema(new SimpleSchema({
  3. title: {
  4. type: String,
  5. optional: true,
  6. },
  7. triggerId: {
  8. type: String,
  9. optional: true,
  10. },
  11. actionId: {
  12. type: String,
  13. optional: true,
  14. },
  15. }));
  16. Rules.mutations({
  17. rename(description) {
  18. return { $set: { description } };
  19. },
  20. });
  21. Rules.helpers({
  22. getAction(){
  23. return Actions.findOne({_id:this.actionId});
  24. },
  25. });
  26. Rules.allow({
  27. update: function () {
  28. // add custom authentication code here
  29. return true;
  30. },
  31. remove: function () {
  32. // add custom authentication code here
  33. return true;
  34. },
  35. insert: function () {
  36. // add custom authentication code here
  37. return true;
  38. },
  39. });