mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 18:10:06 -05:00
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 !
12 lines
671 B
JavaScript
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 };
|