瀏覽代碼

Fix in API user role is not considered.

Thanks to mohammadZahedian and xet7 !

Fixes #5422
Lauri Ojansivu 5 月之前
父節點
當前提交
c062bd63bb
共有 1 個文件被更改,包括 2 次插入5 次删除
  1. 2 5
      server/authentication.js

+ 2 - 5
server/authentication.js

@@ -52,14 +52,11 @@ Meteor.startup(() => {
     }
   };
 
-  // Helper function. Will throw an error if the user does not have read only access to the given board
+  // Helper function. Will throw an error if the user is not active BoardAdmin or active Normal user of the board.
   Authentication.checkBoardAccess = function(userId, boardId) {
     Authentication.checkLoggedIn(userId);
-
     const board = ReactiveCache.getBoard(boardId);
-    const normalAccess =
-      board.permission === 'public' ||
-      board.members.some(e => e.userId === userId && e.isActive);
+    const normalAccess = board.members.some(e => e.userId === userId && e.isActive && !e.isNoComments && !e.isCommentOnly && !e.isWorker);
     Authentication.checkAdminOrCondition(userId, normalAccess);
   };