Implement user auto-deletion for inactive accounts with configurable retention (default 2+ years)#413
Merged
Zakaria-Kofiro merged 17 commits intomasterfrom Aug 18, 2025
Merged
Conversation
Comment on lines
+53
to
+54
| @Index(name = "IDX_USER_TOKEN", columnList = "token"), | ||
| @Index(name = "IDX_USER_LAST_LOGIN", columnList = "last_login_ts")}) |
Collaborator
There was a problem hiding this comment.
Why do you need these indexes?
Collaborator
Author
There was a problem hiding this comment.
Good point - the only useful ones are IDX_USER_NAME and IDX_USER_LAST_LOGIN which are used by findByUserName() for authentication and user lookups (helps login performance) and auto-deletion queries for batch deletions, got rid of the rest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements an automated user deletion system that anonymizes users who haven't logged in within a configurable retention period (default: 2 years). This replaces the previously planned UserService endpoints with a more automated approach to manage inactive users and maintain database hygiene.
Changes
🗄️ Database & Model
last_login_tscolumn tousertable with index for efficient queriesUserentity withlastLoginTsfield (usingjava.time.Instant)last_login_tsto epoch time, preventing re-deletion🔐 Authentication & Login Tracking
TankIdentityStore)TankIdentityStore.validateSSOUser)AdminTokenService,RestSecurityFilter)🤖 Auto-Deletion Service
UserAutoDeletionServicethat runs on server startupsettings.xml:user-auto-deletion-enabled: Enable/disable feature (default: false)user-auto-deletion-retention-days: Days of inactivity before deletion (default: 730)user-auto-deletion-permitted-users: Comma-separated list of protected usersadmin)🛡️ Safety Features
Configuration Example