mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
api: fix set_board_member_permission
If the data is passed as a boolean, through json, data.toLowerCase() raises an error. Also define query which we are returning in case of success.
This commit is contained in:
parent
542cc75dc4
commit
8d81aca439
1 changed files with 7 additions and 2 deletions
|
|
@ -1113,9 +1113,14 @@ if (Meteor.isServer) {
|
||||||
Authentication.checkBoardAccess(req.userId, boardId);
|
Authentication.checkBoardAccess(req.userId, boardId);
|
||||||
const board = Boards.findOne({ _id: boardId });
|
const board = Boards.findOne({ _id: boardId });
|
||||||
function isTrue(data){
|
function isTrue(data){
|
||||||
return data.toLowerCase() === 'true';
|
try {
|
||||||
|
return data.toLowerCase() === 'true';
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
board.setMemberPermission(memberId, isTrue(isAdmin), isTrue(isNoComments), isTrue(isCommentOnly), req.userId);
|
const query = board.setMemberPermission(memberId, isTrue(isAdmin), isTrue(isNoComments), isTrue(isCommentOnly), req.userId);
|
||||||
|
|
||||||
JsonRoutes.sendResult(res, {
|
JsonRoutes.sendResult(res, {
|
||||||
code: 200,
|
code: 200,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue