-
-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jt/create user api validation #35448
Open
Jtang-1
wants to merge
32
commits into
master
Choose a base branch
from
jt/create-user-api-validation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+539
−159
Conversation
This file contains 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
dimagimon
added
Risk: High
Change affects files that have been flagged as high risk.
Risk: Medium
Change affects files that have been flagged as medium risk.
labels
Nov 26, 2024
Jtang-1
force-pushed
the
jt/create-user-api-validation
branch
4 times, most recently
from
November 28, 2024 05:02
6568200
to
1a81553
Compare
…idating Invitation creation via API
… / web user edit API
…to make it easier to tell what values are needed
…pdate web user API
…assigned locations or that primary location is defined if assigned locations is defined
…d format from spec
… used for invite creation API
… of the spec format in preparation for reuse
…for web user API. However, there wasn't as much overlap with validation used for AdminInvitesUserForm. So move validation for Web User Resource its own file and create a class to organize the validations relevant to AdminInvitesUserForm
…lly defined and the conditionally allowed headers should not be preserved upon additional calls to check_header
Jtang-1
force-pushed
the
jt/create-user-api-validation
branch
from
November 28, 2024 05:14
1a81553
to
6366ebf
Compare
couch_user is already included in the request so the test is updated to reflect that. The couch_user is now used in `bulk_user_upload_api` so the test needs to be updated
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Risk: High
Change affects files that have been flagged as high risk.
Risk: Medium
Change affects files that have been flagged as medium risk.
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.
Product Description
Technical Summary
USH-4757
The main change in this PR is the addition of an API validation file. This will support the upcoming API for creating Invitations and updating Web Users. The remaining changes involve refactoring to consolidate validations used when bulk uploading Web Users or creating Invitations via the AdminInvitesUserForm.
I reused relevant validations already defined for bulk user import (in user_importer.validation) since the same checks are needed. Some validations previously implemented via the clean method in Django forms were consolidated, while built-in form validations were left as-is.
The key distinction between Invitation creation via the API and via bulk user import is how existing Web Users are handled. Bulk user import checks if the Web User exists and updates it if so. In contrast, the API will have a dedicated POST endpoint for creation. This endpoint will require validating whether the Invitation or Web User already exists and returning an error if it does, mirroring the behavior of the AdminInvitesUserForm.
Feature Flag
No feature flag
Safety Assurance
Safety story
The main changes (addition of validation for Web User creation API) will not be used yet. The changes to the existing validation code are solely refactors and I tested locally that those areas still work as expected.
Automated test coverage
There exists extensive testing on bulk user imports and surrounding validation.
test_importer
checks that web user and mobile workers can be successfully uploaded/updated.test_validators
test that Location, Profile, Custom Data, etc.. validation catches invalid or unauthorized changes. I will add missing Tableau Group and Role validation.QA Plan
no QA.
Rollback instructions
Labels & Review