-
-
Notifications
You must be signed in to change notification settings - Fork 213
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
Feature: Modify User Status Via API #34557
Merged
snopoke
merged 5 commits into
dimagi:master
from
szymonbalasz:sz/modify-user-status-via-api
May 21, 2024
Merged
Feature: Modify User Status Via API #34557
snopoke
merged 5 commits into
dimagi:master
from
szymonbalasz:sz/modify-user-status-via-api
May 21, 2024
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
the
Risk: High
Change affects files that have been flagged as high risk.
label
May 6, 2024
snopoke
reviewed
May 8, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good but a few changes required.
Thanks for the help! Have made updates as requested |
snopoke
approved these changes
May 21, 2024
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.
Product Description
This change allows activating and deactivating mobile workers via the CommCare HQ API. It enables toggling the active status of mobile worker accounts through API endpoints.
Technical Summary
The changes allow activating and deactivating mobile workers through the CommCare HQ API by adding new endpoints to the UserResource API resource:
The implementation leverages existing code patterns and extracts shared logic into reusable methods. Permissions checks ensure only users with appropriate privileges can perform these actions.
Two new tests were added in
corehq/apps/api/tests/user_resources.py
to verify the activate and deactivate functionality, following the existing test patterns.Feature Flag
Not specific to any feature flag
Safety Assurance
Safety story
The changes were tested locally to verify the activate/deactivate functionality works as expected through the API. Existing permission checks were utilized to restrict access. The implementation follows established coding patterns in the codebase to limit risk.
Since this modifies the status of existing mobile worker data, caution should be exercised when activating/deactivating users. As far as I can tell, existing permission checks are in play.
Automated test coverage
The added tests in
corehq/apps/api/tests/user_resources.py
verify that:UserHistory
entities are created for the modification actionThese tests would catch regressions related to the activate/deactivate API functionality.
QA Plan
Rollback instructions
Labels & Review
Please let me know if you would like me to modify or expand the PR description in any way. I tried to capture the key aspects based on the information provided, but feel free to adapt it as needed.