Fix duplicate user errors encountered in Django admin#4879
Merged
Conversation
Contributor
|
This pull request is not up to date with main. Please merge main into this brach or rebase this branch onto main. This PR should not be approved until all status checks pass. If you see this message, please rerun all status checks before merging. |
Contributor
|
Terraform plan for meta No changes. Your infrastructure matches the configuration.📝 Plan generated in Pull Request Checks #4573 |
Contributor
|
Terraform plan for dev Plan: 1 to add, 0 to change, 1 to destroy.Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
-/+ destroy and then create replacement
Terraform will perform the following actions:
# module.dev.module.cors.null_resource.cors_header must be replaced
-/+ resource "null_resource" "cors_header" {
!~ id = "*******************" -> (known after apply)
!~ triggers = { # forces replacement
!~ "always_run" = "2025-04-09T18:56:10Z" -> (known after apply)
}
}
Plan: 1 to add, 0 to change, 1 to destroy.📝 Plan generated in Pull Request Checks #4573 |
Contributor
|
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.
Addresses #4878
We have encountered an issue with duplicate users when it comes to granting tribal access. We realized that duplicate users are inevitable, and here's why.
Login.gov does not allow multiple accounts to share one email address. However sometimes, a user will delete their account on Login.gov and start a new account. When this user logs into the FAC with a new account (but the same email), we have no way of guaranteeing what the situation is, other than that Login.gov is giving us a unique username... therefore we create a new (but duplicated) user. Logically, the most recently active user (going off of
last_login) is the most up-to-date account.This PR makes some fixes in Django admin to recognize this case and continue to operate without failure.
staffusers.jsonare considered. Only the most recently active user is created into aStaffUser.UserPermissionbased on an email, if the email is tied to more than one user, theUserPermissionis assigned to the most recently logged in user.This PR also exposes Django admins to the
Usertable with read-only access. This is so we can quickly identify duplicate users in our system without the need to perform an SSH operation.How to test
staffusers.json. Then, upon running thecreate_staffusersmanagement command, ALL of the users with your email should haveis_staffuser = true.StaffUserin Django admin.UserPermissionwith your email. You should encounter a successful response rather than an error.PR Checklist: Submitter
maininto your branch shortly before creating the PR. (You should also be mergingmaininto your branch regularly during development.)git status | grep migrations. If there are any results, you probably need to add them to the branch for the PR. Your PR should have only one new migration file for each of the component apps, except in rare circumstances; you may need to delete some and re-runpython manage.py makemigrationsto reduce the number to one. (Also, unless in exceptional circumstances, your PR should not delete any migration files.)PR Checklist: Reviewer
make docker-clean; make docker-first-run && docker compose up; then rundocker compose exec web /bin/bash -c "python manage.py test"The larger the PR, the stricter we should be about these points.
Pre Merge Checklist: Merger
-/+ resource "null_resource" "cors_header"should be destroying and recreating its self and~ resource "cloudfoundry_app" "clamav_api"might be updating itssha256for thefac-file-scannerandfac-av-${ENV}by default.main.