diff options
author | Angelo Gallarello <angelo.gallarell@gmail.com> | 2018-09-12 00:52:29 +0200 |
---|---|---|
committer | Angelo Gallarello <angelo.gallarell@gmail.com> | 2018-09-12 00:52:29 +0200 |
commit | 34b37116cf8c618a4ea12b13d969c24654f4248b (patch) | |
tree | 287193373538fb0c0e6e7d634a21c6e5f85b3811 /models/rules.js | |
parent | 1f5f429fc4535d251d32335eea7e44904a924650 (diff) | |
download | wekan-34b37116cf8c618a4ea12b13d969c24654f4248b.tar.gz wekan-34b37116cf8c618a4ea12b13d969c24654f4248b.tar.bz2 wekan-34b37116cf8c618a4ea12b13d969c24654f4248b.zip |
Fixed rule allows
Diffstat (limited to 'models/rules.js')
-rw-r--r-- | models/rules.js | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/models/rules.js b/models/rules.js index 271e6b52..fe6b04cb 100644 --- a/models/rules.js +++ b/models/rules.js @@ -3,15 +3,19 @@ Rules = new Mongo.Collection('rules'); Rules.attachSchema(new SimpleSchema({ title: { type: String, - optional: true, + optional: false, }, triggerId: { type: String, - optional: true, + optional: false, }, actionId: { type: String, - optional: true, + optional: false, + }, + boardId: { + type: String, + optional: false, }, })); @@ -25,22 +29,21 @@ Rules.helpers({ getAction(){ return Actions.findOne({_id:this.actionId}); }, + getTrigger(){ + return Triggers.findOne({_id:this.triggerId}); + } }); Rules.allow({ - update: function () { - // add custom authentication code here - return true; + insert(userId, doc) { + return allowIsBoardAdmin(userId, Boards.findOne(doc.boardId)); }, - remove: function () { - // add custom authentication code here - return true; - }, - insert: function () { - // add custom authentication code here - return true; + update(userId, doc) { + return allowIsBoardAdmin(userId, Boards.findOne(doc.boardId)); }, + remove(userId, doc) { + return allowIsBoardAdmin(userId, Boards.findOne(doc.boardId)); + } }); - |