2019-06-26 17:47:27 -05:00
|
|
|
import { Meteor } from 'meteor/meteor';
|
|
|
|
|
2018-08-15 18:47:09 +02:00
|
|
|
Actions = new Mongo.Collection('actions');
|
|
|
|
|
|
|
|
Actions.allow({
|
2018-09-16 01:50:36 +03:00
|
|
|
insert(userId, doc) {
|
|
|
|
return allowIsBoardAdmin(userId, Boards.findOne(doc.boardId));
|
|
|
|
},
|
|
|
|
update(userId, doc) {
|
|
|
|
return allowIsBoardAdmin(userId, Boards.findOne(doc.boardId));
|
|
|
|
},
|
|
|
|
remove(userId, doc) {
|
|
|
|
return allowIsBoardAdmin(userId, Boards.findOne(doc.boardId));
|
|
|
|
},
|
2018-09-14 16:49:06 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
Actions.helpers({
|
2018-09-16 01:50:36 +03:00
|
|
|
description() {
|
|
|
|
return this.desc;
|
|
|
|
},
|
|
|
|
});
|
2019-06-26 17:47:27 -05:00
|
|
|
|
|
|
|
if (Meteor.isServer) {
|
|
|
|
Meteor.startup(() => {
|
|
|
|
Actions._collection._ensureIndex({ modifiedAt: -1 });
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Actions;
|