test: Add reimport test case

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2023-07-20 10:55:38 +02:00
parent 39320a9bac
commit 282c1e7d41
2 changed files with 139 additions and 17 deletions

View File

@@ -132,9 +132,13 @@ class DeckJsonService extends ABoardImportService {
if (empty($this->getImportService()->getData()->title)) {
throw new BadRequestException('Invalid name of board');
}
$board->setTitle($this->getImportService()->getData()->title);
$board->setOwner($this->getImportService()->getData()->owner->uid);
$board->setColor($this->getImportService()->getData()->color);
$importBoard = $this->getImportService()->getData();
$board->setTitle($importBoard->title);
$board->setOwner($importBoard->owner->uid);
$board->setColor($importBoard->color);
$board->setArchived($importBoard->archived);
$board->setDeletedAt($importBoard->deletedAt);
$board->setLastModified($importBoard->lastModified);
return $board;
}
@@ -147,6 +151,7 @@ class DeckJsonService extends ABoardImportService {
$newLabel->setTitle($label->title);
$newLabel->setColor($label->color);
$newLabel->setBoardId($this->getImportService()->getBoard()->getId());
$newLabel->setLastModified($label->lastModified);
$this->labels[$label->id] = $newLabel;
}
return $this->labels;
@@ -203,21 +208,17 @@ class DeckJsonService extends ABoardImportService {
* @return Acl[]
*/
public function getAclList(): array {
// FIXME: To implement
$board = $this->getImportService()->getData();
$return = [];
foreach ($this->members as $member) {
if ($member->getUID() === $this->getImportService()->getConfig('owner')->getUID()) {
continue;
}
foreach ($board->acl as $aclData) {
// FIXME: Figure out mapping
$acl = new Acl();
$acl->setBoardId($this->getImportService()->getBoard()->getId());
$acl->setType(Acl::PERMISSION_TYPE_USER);
$acl->setParticipant($member->getUID());
$acl->setPermissionEdit(false);
$acl->setPermissionShare(false);
$acl->setPermissionManage(false);
// FIXME: Figure out a way to collect and aggregate warnings about users
// FIXME: Maybe have a dry run?
$acl->setType($aclData->type);
$acl->setParticipant($aclData->participant?->primaryKey ?? $aclData->participant);
$acl->setPermissionEdit($aclData->permissionEdit);
$acl->setPermissionShare($aclData->permissionShare);
$acl->setPermissionManage($aclData->permissionManage);
$return[] = $acl;
}
return $return;