bcgov / nr-gwells

Groundwater Wells and Aquifers
Apache License 2.0
1 stars 0 forks source link

API Returns Fields that should only be Accessible to Logged in Users with Specific Roles #188

Open lunamoonmoon opened 1 week ago

lunamoonmoon commented 1 week ago

Problem Description **In order to protect fields that are meant to be for certain logged in user roles, we need to determine which fields are needing protection and are currently being sent to the frontend for non-logged in users when they shouldn't be.

Solution Needs

Timebox

Outcome Details describing the outcome of the research

Additional Context Image

raarielgrace commented 2 days ago

Currently, unpublished wells and aquifers are filtered on the FE in:

The data for these calls isn't processed by the API, it's fetched from an endpoint for a specific pbf file. This url is defined in the code with vectorTileServerUrl. New endpoints will need to be added to the API so that the private data can be filtered out in the BE.

The other instance of showing/not showing data based on roles is in the surveys endpoint, which is already filtered in the BE.

Most of the other instances of checking user roles have to do with allowing certain actions, like bulk edits, adding new elements, etc. If we were being really thorough, we would make sure that POST calls from non-authorized users are rejected. Not sure if we do that everywhere or not. Would require another spike ticket.