Skip to content
Merged
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
4 changes: 2 additions & 2 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<summary>NextMagentaCloud business functions for customer tariff evaluation</summary>
<description>This app contains business logic to evaluate provisoning info paased in
as set of openid claim-like attributes</description>
<version>1.1.0</version>
<version>1.2.0</version>
<licence>agpl</licence>
<author>Bernd Rederlechner</author>
<namespace>NextMagentaCloudProvisioning</namespace>
Expand All @@ -18,7 +18,7 @@ as set of openid claim-like attributes</description>
<!-- NextMagentaCloud support must check functionality and increase max-version
with each major release change. See architecture documentation for details.
-->
<nextcloud min-version="22" max-version="30"/>
<nextcloud min-version="25" max-version="31"/>
</dependencies>
<background-jobs>
<job>OCA\NextMagentaCloudProvisioning\User\UserAccountDeletionJob</job>
Expand Down
16 changes: 16 additions & 0 deletions lib/Db/UserQueries.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
6 changes: 5 additions & 1 deletion lib/User/UserAccountDeletionJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down