Limit card assignment to users who are participants of the board

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2019-12-19 20:26:19 +01:00
parent 87835c923f
commit 6fa7295b42
2 changed files with 35 additions and 1 deletions

View File

@@ -588,10 +588,17 @@ class CardService {
$assignments = $this->assignedUsersMapper->find($cardId);
foreach ($assignments as $assignment) {
if ($assignment->getParticipant() === $userId) {
return false;
throw new BadRequestException('The user is already assigned to the card');
}
}
$card = $this->cardMapper->find($cardId);
$boardId = $this->cardMapper->findBoardId($cardId);
$boardUsers = array_keys($this->permissionService->findUsers($boardId));
if (!in_array($userId, $boardUsers)) {
throw new BadRequestException('The user is not part of the board');
}
if ($userId !== $this->currentUser) {
/* Notifyuser about the card assignment */