Improve inactive user management with functional api activity#5257
Open
guerricv wants to merge 12 commits into
Open
Improve inactive user management with functional api activity#5257guerricv wants to merge 12 commits into
guerricv wants to merge 12 commits into
Conversation
Add method to mark API functional activity for user.
Added functionality to track API activity for users and update their last connection timestamp accordingly.
Clarified the criteria for inactive user management by specifying that inactivity is based on recent web login or functional API/extension activity.
Updated the description of inactive users to clarify criteria for inactivity.
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
This change updates inactive user management so browser extension and API users are not incorrectly treated as inactive when they perform real TeamPass actions without logging into the PHP web interface.
The implementation does not require a database schema migration. It reuses
users.last_connexionas the canonical "last functional activity" timestamp for inactivity handling.Problem
Inactive user management previously relied on
users.last_connexion, which is updated by web login flows but not by API or browser extension usage.As a result, users who actively used TeamPass through the browser extension or API could still receive inactive-account warning emails, and later be disabled or deleted by the automated grace-period action.
At the same time, a simple API authentication, JWT validation, token refresh, or extension settings refresh should not be enough to keep an account active. Those are technical session events, not necessarily user-visible activity.
Changes
app/sources/main.functions.php./authorize/authorizeTokenapi/index.phpusers.last_connexiontp_src=apiusers.last_connexionduring the worker run when a newer functional API activity is found in logs.No Database Migration
No new table, column, index, or upgrade script is required.
The change intentionally reuses the existing
users.last_connexionfield as the inactivity baseline. Its practical meaning becomes "last functional user activity" for inactive-user management.Activity Semantics
Counts as activity:
Does not count as activity on its own:
Performance Notes
API activity updates are throttled in the shared helper to avoid rewriting
users.last_connexionon every repeated request.The inactive-user worker performs one grouped lookup against
log_itemsfor the users it is already checking. It does not perform one log query per user.Security Notes
This change does not expose new API data, token data, session identifiers, key material, or item content.
It only updates inactivity metadata for the authenticated user after successful functional actions.
Validation
tests/Unit/InactiveUsersApiActivityTest.phpstatic regression coverage.