bitcointranscripts / transcription-review-backend

7 stars 11 forks source link

feat: add evaluator role #292

Closed Extheoisah closed 3 months ago

Extheoisah commented 4 months ago

This pr adds a new role to the user permissions enum. It closes https://github.com/bitcointranscripts/transcription-review-backend/issues/290

This PR also cleans up the user section of the swagger docs since the code touches the user route. Previously, the docs didn't account for the JWT bearer token appended to the headers and the signing route doesn't work in Swagger due to the absence of an API key implementation.

Extheoisah commented 4 months ago

I tested this code locally but connected to the staging db. The updated swagger looks good, I tested all the User endpoints and I was able to change the permissions of a user to "evaluator".

I didn't test the endpoints using an "evaluator" role to verify that the permissions work as expected.

To test the evaluator role:

  1. ensure your new role is now an evaluator.
  2. use the sign-in endpoint to login. Make sure you add your github access token to the headers of the signing endpoint. Screenshot 2024-05-29 at 10 06 38
  3. You should get a new JWT with the updated permissions.
  4. use the new JWT to test the update users endpoint, it should return "Admin role required!"