actions.js 601 B

1234567891011121314151617181920212223242526272829
  1. import { Meteor } from 'meteor/meteor';
  2. Actions = new Mongo.Collection('actions');
  3. Actions.allow({
  4. insert(userId, doc) {
  5. return allowIsBoardAdmin(userId, Boards.findOne(doc.boardId));
  6. },
  7. update(userId, doc) {
  8. return allowIsBoardAdmin(userId, Boards.findOne(doc.boardId));
  9. },
  10. remove(userId, doc) {
  11. return allowIsBoardAdmin(userId, Boards.findOne(doc.boardId));
  12. },
  13. });
  14. Actions.helpers({
  15. description() {
  16. return this.desc;
  17. },
  18. });
  19. if (Meteor.isServer) {
  20. Meteor.startup(() => {
  21. Actions._collection._ensureIndex({ modifiedAt: -1 });
  22. });
  23. }
  24. export default Actions;