Class AccountDeletionService
java.lang.Object
io.meeds.social.security.service.AccountDeletionService
Executes the account deletion requests recorded by
AccountDeactivationService, once their grace delay elapsed. This
service starts no transaction on its own: the caller (the job) owns the
container lifecycle, and the batch commits one transaction per processed
account — marker removal and deletion together — so the processing stays
idempotent without any cluster lock: a concurrent or replayed run finds no
marker once an account's transaction is committed, and the deletion itself
(IDM user removed, then the social identity deleted) is a no-op once the
IDM user is gone.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteAccount(String username) Deletes the account: the IDM user is removed first, notifying the user deletion listeners, then the social identity is deleted.booleanprepareDeletion(String username) Re-checks the eligibility of one recorded request and, when the account has to be deleted, removes the request marker — committed together with the deletion in the per-account transaction controlled by the caller — so a replayed run finds nothing to do.voidprocessPendingDeletionRequestOf(String username) voidProcesses all the recorded deletion requests: collects the pending requesters first (the enumeration must not be paged over while its rows get deleted), then handles each account independently so one failure never prevents the other deletions.
-
Field Details
-
ACCOUNT_DELETED_EVENT
- See Also:
-
-
Constructor Details
-
AccountDeletionService
public AccountDeletionService()
-
-
Method Details
-
processPendingDeletionRequests
public void processPendingDeletionRequests()Processes all the recorded deletion requests: collects the pending requesters first (the enumeration must not be paged over while its rows get deleted), then handles each account independently so one failure never prevents the other deletions. The current transaction is committed and reopened after each account, so the batch never accumulates one big transaction and a mid-batch failure never rolls back the already processed accounts. -
processPendingDeletionRequestOf
-
collectPendingRequests
-
prepareDeletion
Re-checks the eligibility of one recorded request and, when the account has to be deleted, removes the request marker — committed together with the deletion in the per-account transaction controlled by the caller — so a replayed run finds nothing to do. The marker is also cleaned up for requests that can never execute anymore (revoked by an admin re-activation, user already gone, externally synchronized account or unreadable marker). Deliberately not re-checked: the admin deletion option — the request was confirmed by its user under an enabled policy, turning the option off only prevents new requests.- Returns:
- true when the account deletion must proceed
- Throws:
Exception
-
deleteAccount
Deletes the account: the IDM user is removed first, notifying the user deletion listeners, then the social identity is deleted. The listeners may resolve the social identity by username while the IDM user still exists, which would restore an identity deleted beforehand, so the identity is deleted after the user. The social user listener has already deleted it in its post-deletion step; deleting it again here is harmless and covers that listener's catch-and-log. The user deletion listeners remove the user's personal data, including their personal documents and personal notes; the content they published to spaces and streams (activities, comments) is kept and still displayed.- Throws:
Exception
-