Files
wekan/models/lib/cardCopyDestination.js
T
Lauri Ojansivu c35ba4b35e Validate server card-copy destinations before reads and writes
Require existing destination containers on the requested board before sort
reads, number allocation, field remapping and child copies. Reject soft-deleted
containers and return a clear REST input error without security-account blocks.
Preserve board-wide lists and archived-container board-copy behavior.

Cover invalid and valid placement with unit, DDP, REST and browser tests,
including existing ordinary, rule, Scrum, list and swimlane copy paths.
Record the remaining source-access and concurrent-write review.

Thanks to xet7 !
2026-09-29 00:13:43 +03:00

12 lines
671 B
JavaScript

'use strict';
function validCardCopyDestination(boardId, swimlaneId, listId, board, swimlane, list) {
return [boardId, swimlaneId, listId].every(id => typeof id === 'string' && id.length > 0) &&
!!board && board._id === boardId && board.deletedAt == null &&
!!swimlane && swimlane._id === swimlaneId && swimlane.deletedAt == null &&
swimlane.boardId === boardId && !!list && list._id === listId && list.boardId === boardId && list.deletedAt == null;
}
// Lists can be board-wide, and board copies preserve archived containers.
// This is a placement check; caller-specific permissions remain with the caller.
module.exports = { validCardCopyDestination };