[BE] Restrict the report to return only the data the user is authorized to access

Description

Since the report can be generated using only a date, we must ensure that users can only access records they are authorized to view. The backend should enforce this by filtering and returning only the records the user is permitted to see, applying facility, program, and product constraints.

NOTE: Even if no filters are provided, the BE must still perform this access check.

AC:

  1. Users can only access records for permitted facilities, programs, and products.

  2. The BE must enforce access restrictions even if no filters are provided.

  3. Unauthorized records must be excluded from the report.

Solution Concept:

  • When generating the report, pass the userId as a parameter and modify the SQL query accordingly to meet the requirements.

Attachments

2

Checklists

Activity

Show:

Oliver Lewandowski February 17, 2025 at 3:12 PM
Edited

Status:

Description: The test was conducted using the administrator2 user, assigned a single supervision role (Essential Meds, Stock Viewer).

As a result, the report should display only the SOH from the Comfort Health Clinic (home facility) and the Essential Meds (program). Despite selecting "All" in the Facility and Program filters, the report correctly limited the output.

Piotr Wargulak February 7, 2025 at 11:17 AM

Merged.

Maciej Grochalski February 6, 2025 at 6:48 PM
Edited

pr:

could you please take a look?

Oliver Lewandowski February 3, 2025 at 1:20 PM

NOTE: The email with the question about filter usage in the report has been sent. The description and AC may be updated based on the client's response.\

Oliver Lewandowski January 31, 2025 at 9:39 AM

Can you check and refine if needed?

Unresolved
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Original estimate

Time tracking

4h logged2d 4h remaining

Priority

Time Assistant

Created January 31, 2025 at 9:38 AM
Updated April 1, 2025 at 2:51 PM