diff --git a/appinfo/info.xml b/appinfo/info.xml
index 0960729..6ddc602 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -6,7 +6,7 @@
NextMagentaCloud business functions for customer tariff evaluation
This app contains business logic to evaluate provisoning info paased in
as set of openid claim-like attributes
- 1.1.0
+ 1.2.0
agpl
Bernd Rederlechner
NextMagentaCloudProvisioning
@@ -18,7 +18,7 @@ as set of openid claim-like attributes
-
+
OCA\NextMagentaCloudProvisioning\User\UserAccountDeletionJob
diff --git a/lib/Db/UserQueries.php b/lib/Db/UserQueries.php
index 9b0cf66..ea3a3ef 100644
--- a/lib/Db/UserQueries.php
+++ b/lib/Db/UserQueries.php
@@ -75,4 +75,20 @@ public function countMigrated(): int {
$result->closeCursor();
return $column;
}
+
+ /**
+ * Delete a user preference by their user ID
+ *
+ * @param string $userId
+ * @return bool True if deletion was successful, false otherwise
+ */
+ public function deleteUserPreferenceById(string $userId): bool {
+ $qb = $this->db->getQueryBuilder();
+
+ $qb->delete('preferences')
+ ->where($qb->expr()->eq('userid', $qb->createNamedParameter($userId)))
+ ->execute();
+
+ return true; // Return true to indicate successful deletion
+ }
}
diff --git a/lib/User/UserAccountDeletionJob.php b/lib/User/UserAccountDeletionJob.php
index 6829df9..9075693 100644
--- a/lib/User/UserAccountDeletionJob.php
+++ b/lib/User/UserAccountDeletionJob.php
@@ -66,7 +66,11 @@ public function run($arguments) {
try {
$user = $this->userManager->get($uid);
if (!$user) {
- $this->logger->warning("User $uid not found, skipping.");
+ $this->logger->warning("User $uid not found, removing deletion entry and cleaning up.");
+
+ // Call deleteUserPreferenceById to ensure cleanup
+ $this->userQueries->deleteUserPreferenceById($uid);
+
continue;
}