Enhance user account management workflows - #284
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
A few new flows lack defensive input handling and robust parameter coercion, which can lead to avoidable 500s or report failures in production.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR expands ALDashboard’s user-account management tooling by adding richer account/session visibility (including recent activity reporting) and a server-sent password reset email flow, while tightening and reusing permission checks for cross-user session access.
Changes:
- Added
can_access_user_sessions()(and supporting permission helper) and reused it to gate session visibility across the dashboard. - Added user-centric session viewing (including anonymous temp-user drill-down) and a “recently active users” report.
- Added “send password reset email” using docassemble’s built-in user manager, plus UI wiring and tests.
File summaries
| File | Description |
|---|---|
| docassemble/ALDashboard/aldashboard.py | Adds permission helper, reset-email sender, recent-activity reporting, and extends session query to support anonymous temp-user filtering. |
| docassemble/ALDashboard/data/questions/manage_users.yml | Updates the Manage Users interview UI to show last-login/session stats, adds reset-email flow, session viewer, and recent-activity report/drill-down. |
| docassemble/ALDashboard/data/questions/list_sessions.yml | Switches several “admin/developer” gates to can_access_user_sessions() so authorized support users can access broader session tooling. |
| docassemble/ALDashboard/test/test_user_account_manager.py | New tests covering permission gating, UI wiring in manage_users.yml, and password reset email behavior. |
| docassemble/ALDashboard/test/test_session_search.py | Updates tests for the revised session query structure and adds coverage for permission checks and temp-user filtering. |
| docassemble/ALDashboard/test/test_session_details_and_files.py | Adjusts tests to reflect get_allowed_interview_filenames() now depending on login/session-access logic. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Closes #283.
Summary
Permissions and performance
Cross-user interview access requires the existing access-sessions and access-user-info permissions. Non-admin support users cannot inspect or modify protected admin, developer, or cron accounts.
Session queries limit recent candidates before joining user and metadata records. Recent registered-session aggregation is restricted to the users displayed in the report, and account lookup does not load the complete user table on servers above the threshold.
Development and review history
This implementation went through several rounds of local testing and revision:
Testing