Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions lib/Service/AliasesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use OCA\Mail\Db\MailAccountMapper;
use OCA\Mail\Exception\ClientException;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\DB\Exception;

class AliasesService {
/** @var AliasMapper */
Expand Down Expand Up @@ -133,4 +134,16 @@ public function updateSignature(string $userId, int $aliasId, ?string $signature
$entity->setSignature($signature);
return $this->aliasMapper->update($entity);
}

/**
* Update the S/MIME certificate for an alias.
*
* @throws DoesNotExistException
* @throws Exception
*/
public function updateSMIMECertificateId(string $userId, int $aliasId, ?int $sMimeCertificateId = null): Alias {
$entity = $this->find($aliasId, $userId);
$entity->setSmimeCertificateId($sMimeCertificateId);
return $this->aliasMapper->update($entity);
}
}
11 changes: 7 additions & 4 deletions lib/UserMigration/MailAccountMigrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct(
private readonly TrustedSendersMigrationService $trustedSendersMigrationService,
private readonly TextBlocksMigrationService $textBlocksMigrationService,
private readonly TagsMigrationService $tagsMigrationService,
private readonly SMIMEMigrationService $smimeMigrationService,
private readonly SMIMEMigrationService $sMimeMigrationService,
) {
}

Expand All @@ -58,7 +58,8 @@ public function export(IUser $user,
$this->trustedSendersMigrationService->exportTrustedSenders($user, $exportDestination, $output);
$this->textBlocksMigrationService->exportTextBlocks($user, $exportDestination, $output);
$this->tagsMigrationService->exportTags($user, $exportDestination, $output);
$this->smimeMigrationService->exportCertificates($user, $exportDestination, $output);
$this->sMimeMigrationService->exportCertificates($user, $exportDestination, $output);
$this->accountMigrationService->exportAccounts($user, $exportDestination, $output);
}

#[\Override]
Expand All @@ -71,8 +72,9 @@ public function import(IUser $user, IImportSource $importSource, OutputInterface
$this->internalAddressesMigrationService->importInternalAddresses($user, $importSource, $output);
$this->trustedSendersMigrationService->importTrustedSenders($user, $importSource, $output);
$this->textBlocksMigrationService->importTextBlocks($user, $importSource, $output);
$newCertificateIds = $this->sMimeMigrationService->importCertificates($user, $importSource, $output);
$newAccountIds = $this->accountMigrationService->importAccounts($user, $importSource, $output, $newCertificateIds);
$newTagIds = $this->tagsMigrationService->importTags($user, $importSource, $output);
$newCertificateIds = $this->smimeMigrationService->importCertificates($user, $importSource, $output);

$this->accountMigrationService->scheduleBackgroundJobs($user, $output);
}
Expand All @@ -90,13 +92,14 @@ public function import(IUser $user, IImportSource $importSource, OutputInterface
private function deleteExistingData(IUser $user, OutputInterface $output): void {
$output->writeln($this->l10n->t("Deleting existing mail data for user {$user->getUID()}"), OutputInterface::VERBOSITY_VERBOSE);

$this->accountMigrationService->deleteAllAccounts($user, $output);
$this->appConfigMigrationService->deleteAppConfiguration($user, $output);
$this->internalAddressesMigrationService->removeInternalAddresses($user, $output);
$this->trustedSendersMigrationService->removeAllTrustedSenders($user, $output);
$this->textBlocksMigrationService->deleteAllTextBlocks($user, $output);
$this->tagsMigrationService->deleteAllTags($user, $output);
$this->accountMigrationService->deleteAllAccounts($user, $output);
$this->smimeMigrationService->deleteAllUserCertificates($user, $output);
$this->sMimeMigrationService->deleteAllUserCertificates($user, $output);
}

#[\Override]
Expand Down
Loading
Loading