Skip to content
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

Regional User Request Access #3440

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from
Open

Conversation

elipe17
Copy link

@elipe17 elipe17 commented Jan 23, 2025

Summary of Changes

  • Added support for acf domain based users to select whether they're central or regional users
  • Added frontend support for selecting regions for regional users
  • Refactored the request access form into it's own component
  • Added new frontend tests to test the new form component
  • Added support in the backend to allow a user to be associated with multiple regions and vice versa
  • Updated email templates to handle regional vs central access request/approved emails
  • Added new form fields for e2e tests
    Pull request closes Update the existing OFA access workflow to include regions #3384

How to Test

cd tdrs-frontend && docker-compose up --build
cd tdrs-backend && docker-compose up --build
  1. Open http://localhost:3000/ and sign in.
  2. Request access as a normal central user, make sure you try introducing form errors to verify the errors and count of errors looks good.
  3. Verify you can successfully request access and that your user is updated etc...
  4. To test as the regional user, you can modify line 247 in RequestAccessForm from {isAMSUser && ( to {!isAMSUser && (. Notice the addition of the bang symbol.
  5. Now log in, and request access again. Toggle the regional radio buttons to verify functionality.
  6. Introduce/fix form errors with and without the regional checkboxes rendered
  7. select one or more regions for your user, and request access
  8. Verify the user is created and that it is correctly associated with the regions you chose.

Deliverables

More details on how deliverables herein are assessed included here.

Deliverable 1: Accepted Features

Checklist of ACs:

  • When a user with an ACF email domain, they should be presented with the region checkboxes
  • Regional user is emailed when access is submitted, approved, and/or denied.
  • The regional user must select 1+ region(s).
  • DAC should allow regional user with null STTs if region is selected.
  • Testing Checklist has been run and all tests pass
  • README is updated, if necessary

Deliverable 2: Tested Code

  • Are all areas of code introduced in this PR meaningfully tested?
    • If this PR introduces backend code changes, are they meaningfully tested?
    • If this PR introduces frontend code changes, are they meaningfully tested?
  • Are code coverage minimums met?
    • Frontend coverage: [insert coverage %] (see CodeCov Report comment in PR)
    • Backend coverage: [insert coverage %] (see CodeCov Report comment in PR)

Deliverable 3: Properly Styled Code

  • Are backend code style checks passing on CircleCI?
  • Are frontend code style checks passing on CircleCI?
  • Are code maintainability principles being followed?

Deliverable 4: Accessible

  • Does this PR complete the epic?
  • Are links included to any other gov-approved PRs associated with epic?
  • Does PR include documentation for Raft's a11y review?
  • Did automated and manual testing with iamjolly and ttran-hub using Accessibility Insights reveal any errors introduced in this PR?

Deliverable 5: Deployed

  • Was the code successfully deployed via automated CircleCI process to development on Cloud.gov?

Deliverable 6: Documented

  • Does this PR provide background for why coding decisions were made?
  • If this PR introduces backend code, is that code easy to understand and sufficiently documented, both inline and overall?
  • If this PR introduces frontend code, is that code easy to understand and sufficiently documented, both inline and overall?
  • If this PR introduces dependencies, are their licenses documented?
  • Can reviewer explain and take ownership of these elements presented in this code review?

Deliverable 7: Secure

  • Does the OWASP Scan pass on CircleCI?
  • Do manual code review and manual testing detect any new security issues?
  • If new issues detected, is investigation and/or remediation plan documented?

Deliverable 8: User Research

Research product(s) clearly articulate(s):

  • the purpose of the research
  • methods used to conduct the research
  • who participated in the research
  • what was tested and how
  • impact of research on TDP
  • (if applicable) final design mockups produced for TDP development

- Pulled form elements out of Home component
- Create custom through model
- Update serializer to handle new many to many field
- Temporary migrations
- Update request access patch to include selected regions
- Remove unused imports
- Update regions info to be a set to ensure no duplicates and easy manipulation
@elipe17 elipe17 self-assigned this Jan 23, 2025
- Updated region checkbox error state to be smarter
Copy link

codecov bot commented Jan 23, 2025

Codecov Report

Attention: Patch coverage is 91.33858% with 11 lines in your changes missing coverage. Please review.

Project coverage is 91.33%. Comparing base (1466354) to head (d1c0e94).
Report is 20 commits behind head on develop.

Files with missing lines Patch % Lines
...backend/tdpservice/email/helpers/account_status.py 33.33% 4 Missing and 2 partials ⚠️
...components/RequestAccessForm/RequestAccessForm.jsx 94.04% 3 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #3440      +/-   ##
===========================================
- Coverage    91.43%   91.33%   -0.10%     
===========================================
  Files          300      301       +1     
  Lines         8647     8677      +30     
  Branches       640      652      +12     
===========================================
+ Hits          7906     7925      +19     
- Misses         621      628       +7     
- Partials       120      124       +4     
Flag Coverage Δ
dev-backend 91.19% <85.00%> (-0.11%) ⬇️
dev-frontend 92.32% <94.25%> (-0.12%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
tdrs-backend/tdpservice/data_files/views.py 89.09% <100.00%> (+0.10%) ⬆️
tdrs-backend/tdpservice/users/admin.py 86.11% <100.00%> (+4.62%) ⬆️
...s/migrations/0042_create_regions_m2m_del_region.py 100.00% <100.00%> (ø)
tdrs-backend/tdpservice/users/models.py 91.91% <100.00%> (+0.34%) ⬆️
tdrs-backend/tdpservice/users/permissions.py 100.00% <100.00%> (ø)
tdrs-backend/tdpservice/users/serializers.py 100.00% <100.00%> (ø)
tdrs-backend/tdpservice/users/test/factories.py 100.00% <ø> (ø)
tdrs-backend/tdpservice/users/views.py 96.00% <ø> (ø)
tdrs-frontend/src/actions/requestAccess.js 100.00% <100.00%> (ø)
tdrs-frontend/src/components/Home/Home.jsx 100.00% <100.00%> (+1.78%) ⬆️
... and 2 more

... and 10 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d5c0c2d...d1c0e94. Read the comment docs.

@elipe17 elipe17 added frontend backend dev raft review This issue is ready for raft review a11y-review PR is ready for accessibility review labels Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a11y-review PR is ready for accessibility review backend dev frontend raft review This issue is ready for raft review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update the existing OFA access workflow to include regions
1 participant