Merge branch 'master' of https://github.com/Robert-Lebedeu/wekan into Robert-Lebedeu-master

This commit is contained in:
Lauri Ojansivu 2019-12-20 16:09:48 +02:00
commit 0649add494
3 changed files with 18 additions and 4 deletions

View file

@ -2003,8 +2003,15 @@ if (Meteor.isServer) {
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 card to the board
const board = Boards.findOne({
_id: paramBoardId
});
const addPermission = allowIsBoardMemberCommentOnly(req.userId, board);
Authentication.checkAdminOrCondition(req.userId, addPermission);
const paramListId = req.params.listId;
const paramParentId = req.params.parentId;
const currentCards = Cards.find(

View file

@ -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,

View file

@ -58,7 +58,7 @@ Meteor.startup(() => {
const board = Boards.findOne({ _id: boardId });
const normalAccess =
board.permission === 'public' ||
board.members.some(e => e.userId === userId).isActive;
board.members.some(e => e.userId === userId && e.isActive);
Authentication.checkAdminOrCondition(userId, normalAccess);
};