PhilanthropyDataCommons / service

A project for collecting and serving public information associated with grant applications
GNU Affero General Public License v3.0
8 stars 2 forks source link

Add Users #876

Closed slifty closed 7 months ago

slifty commented 7 months ago

This PR adds the concept of a user to the PDC. Users are not a REST concept at this point, but rather the User state is associated with a given request based on the JWT subject.

We are relying on JWTs for authentication, so "users" also exist outside of the PDC in whatever auth service is being set up (our project recommends Keycloak, but the service is implementation agnostic). That is to say: we haven't needed to have users in the past for authorization, because it was really just a binary state -- either you have a valid JWT or you don't.

We're about to start supporting things like data ownership in the PDC, and in order to do that we need to be able to capture some basic authentication information about the current user.

Resolves #710

slifty commented 7 months ago

I'm confused... why is CI only running Build?

edit: I bet it's because this is based against a branch other than main! Ok, that's a fun edge case. Worth fixing later in the CI settings but for now I'll rebase against main instead.

codecov[bot] commented 7 months ago

Codecov Report

Attention: Patch coverage is 93.18182% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 87.97%. Comparing base (ab88454) to head (82a07c7). Report is 10 commits behind head on main.

:exclamation: Current head 82a07c7 differs from pull request most recent head dfd5cdf. Consider uploading reports for the commit dfd5cdf to get more accurate results

Files Patch % Lines
src/middleware/addUserContext.ts 88.88% 2 Missing :warning:
src/database/operations/create/createUser.ts 87.50% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #876 +/- ## ========================================== + Coverage 87.82% 87.97% +0.15% ========================================== Files 106 109 +3 Lines 1445 1488 +43 Branches 177 182 +5 ========================================== + Hits 1269 1309 +40 - Misses 161 164 +3 Partials 15 15 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.