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

Remote signer Implementation #640

Merged
merged 12 commits into from
Nov 16, 2023
Merged

Conversation

dpgraham4401
Copy link
Member

@dpgraham4401 dpgraham4401 commented Nov 16, 2023

Description

This is a big step in the haztrak application. This implements EPA's Remote Signer Policy.

In order to do this, we also implement something else. Organizations.

Now all users are created within the context of an HaztrakOrg, the organization has (currently just one) admin. If the admin has set up Haztrak with their RCRAInfo API credentials, users in the admin's organization can use their API credentials to interact with the RCRAInfo web services. Otherwise.

Future implementation possibilities.

  1. If a user does not belong to an organization, but has provided their RCRAInfo credentials, allow them to interact with RCRAInfo
  2. Allow the admin to designate whether users in the organization can interact with RCRAInfo or not. Add this information as a property to the user's profile and store that information in the global state on the front end.

Generally speaking this PR does a number of other things as well.

  1. update the CI triggers and conditions so tests are run on pushes to forks, and release drafter and dep review is only run on PR to usepa/haztrak
  2. add a use's organization site permissions to the user's profile page (along with organization information)
  3. reorganization RcraProfile model's relationship with users. The RcraProfile is now connected to the HaztrakProfile instead of directly connected to the user (since it's not a necessary thing to have anymore (non RCRAInfo registered users do not need to have a RcrainfoProfile)
  4. some hot fixes such as do not cache results from RCRAInfo if error from response
  5. create a new constructor that takes a username and returns a RcrainfoService with the appropriate API credentials depending on the users
  6. pulls in a new development dependency faker for mocking data for test factories for more robustness and also makes writing test data a more pleasant experience since avoiding database integrity errors is a little easier

Issue ticket number and link

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

dpgraham4401 and others added 12 commits November 15, 2023 20:17
* Create HaztrakOrg model and fix MinLengthValidtor for HaztrakSite

* add admin field to HaztrakOrg which points to HaztrakUser
* add org to haztrak site model

* add Faker package for creating fake fixtures and random names to avoid integrity errors, adjust fixures to use new HaztrakOrg

* new organization service module

* refactor site search endpoint so business logic is in our services module

* move json fixtures from resources to fixtures, use faker pytest fixture

* alter siteType for consistency, add custom faker provider SiteIDProvider for
generating EPA site IDs, allow RcraSiteSearchView to use case capitolized (or
not) siteType parameters

* use faker in more of our model factories

* finish using faker to mock random data in our test suite

* reorg so rcraprofile is connected to haztrakprofile instead of user

* clean up __init__ function for RcrainfoService

* move RcraProfile model test suite to core django app

* add test suite for HaztrakOrg property fields and set  ordering to HaztrakOrg.name

* minor meta changes and squash migrations

* update triggers and contraints for running tests, release-drafter, and dependency review

* remove faker from RcraPhone factory for now

* fixture integraity error fixes
…lass based on the user calling

adjust __init__ function of manifest service to use new RcrainfoService constructor

remove redundant class for testing RcrainfoService

modify constructor to use api ID and Key if they are passed in
…vice level function for getting or creating a RcraProfile model

RcraApiBtn uses the org information (if rcrainfoIntegrated is true)
add steps to create a haztrak profile (when creating a RcraProfile) if it's not present and connecting the new RcraProfile to the user account (via the HaztrakProfile)
…le (with SitePermissions subcomponent) and RcraProfile
@github-actions github-actions bot added CI/CD Requires modiciations to the continuous integration pipeline(s) client Related to front end workings (React/Redux) database changes that require modification to the database schema dependencies project dependency problems or modifications documentation Improvements or additions to documentation server Related to backend workings (Django/Rest API) test Unit tests are, or need to be, included labels Nov 16, 2023
@dpgraham4401
Copy link
Member Author

closes #635

@dpgraham4401 dpgraham4401 merged commit 78210f0 into USEPA:main Nov 16, 2023
7 checks passed
@dpgraham4401 dpgraham4401 deleted the remote_signer branch November 16, 2023 01:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/CD Requires modiciations to the continuous integration pipeline(s) client Related to front end workings (React/Redux) database changes that require modification to the database schema dependencies project dependency problems or modifications documentation Improvements or additions to documentation server Related to backend workings (Django/Rest API) test Unit tests are, or need to be, included
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant