CRASM-3748 Removed users due to inactivity are not displayed in logs#1511
CRASM-3748 Removed users due to inactivity are not displayed in logs#1511kirakaplinski wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
With my small fix, I tested locally and it all worked great.
I tested by runnning this command while npm start was running:
docker compose -f docker-compose.yml -f docker-compose.override.local.yml exec backend python -c " from xfd_api.tasks.checkUserExpiration import handler import os os.environ['STAGE'] = 'staging' print(handler({'Test': True, 'email': 'local-expiry-test-$(date +%s)@example.com'}, {})) "
That command runs the test user flow (adds an expiring user, then initiates the lambda handler).
Resulted in the database object here:
And in the application it looks like this:
|
Didn't notice at first, but the User Type and Organization fields in the table are N/A. It should be possible to query that and store in the Log table payload field. You'd have to update the call to pull the User and organization with a prefetch_related('roles_organization') Acted-on User Name should be able to be filled too. Acting USer Name can remain null as there's no specific Admin performing the action. You may need to refer to the frontend table to see how it's pulling these fields from the payload: Specifically this line: |
Co-authored-by: aloftus23 <79927030+aloftus23@users.noreply.github.com>
🗣 Description
Fixes to show in the logs automatically removed users due to inactivity. The log table gets updated with the removed user info.
Backend:
backend/src/xfd_django/xfd_api/tasks/checkUserExpiration.py - added logic to update log table for removed users due to inactivity.
backend/src/xfd_django/xfd_api/tests/test_check_user_expiration.py - added test cases to test the new logic.
backend/worker/entrypoint.playwright.sh - added disable=SC2317,SC2329 to resolve pre-commit error
infrastructure/cloudtrail.tf - added the template to support macbook - ARM Apple Silicon.
💭 Motivation and context
Admin Tools → User Logs: automatically removed users do not appear in the filtered results.
This change solves this problem and updates the log table when user removed due inactivity.
🧪 Testing
The changes have been added to unit test component and tested.
Here's the screenshot:
📷 Screenshots
✅ Pre-approval checklist
bump_versionscript if this repository is versioned and the changes in this PR warrant a version bump.✅ Pre-merge checklist
✅ Post-merge checklist