GTBitsOfGood / canine-assistants

Educating the Dogs Who Change the World
https://dev--canine-assistants.netlify.app
MIT License
4 stars 0 forks source link

[BE] Protect all backend API routes #221

Closed afazio1 closed 2 months ago

afazio1 commented 3 months ago

Description

Currently, our frontend code restricts views / buttons based on user role. However, some of our backend API routes are not protected.

Add authorization to our backend API routes that don't already have it. Most GET API endpoints already have protection. For instance, Volunteer/Recipients only see limited information about a dog. A lot of the action API routes are missing authorization. For instance, only Admin + Managers should be able to delete dogs.

Authorization is based on user role and/or association. You can get a user's association with a dog using our backend utility function! Try to organize your auth logic into a function that can be reused across all our API routes. Here are the rules, if you are unsure of a rule ✨ ASK LEADERSHIP ✨. Roles: Manager

Admin

Associations: Instructor/Caregiver

Volunteer/Recipient