2
0
Эх сурвалжийг харах

Allow checklist creation for board members
- Only for members with checklist add permission

Robert Lebedeu 5 жил өмнө
parent
commit
a35df88805
1 өөрчлөгдсөн 9 нэмэгдсэн , 2 устгасан
  1. 9 2
      models/checklists.js

+ 9 - 2
models/checklists.js

@@ -283,8 +283,15 @@ if (Meteor.isServer) {
     'POST',
     '/api/boards/:boardId/cards/:cardId/checklists',
     function(req, res) {
-      Authentication.checkUserId(req.userId);
-
+      // Check user is logged in
+      Authentication.checkLoggedIn(req.userId);
+      const paramBoardId = req.params.boardId;
+      // Check user has permission to add checklist to the card
+      const board = Boards.findOne({
+        _id: paramBoardId
+      });
+      const addPermission = allowIsBoardMemberCommentOnly(req.userId, board);
+      Authentication.checkAdminOrCondition(req.userId, addPermission);
       const paramCardId = req.params.cardId;
       const id = Checklists.insert({
         title: req.body.title,