O3-4616: Add permission check for placing retrospective orders on behalf of another provider#5729
O3-4616: Add permission check for placing retrospective orders on behalf of another provider#5729akash8843 wants to merge 2 commits intoopenmrs:masterfrom
Conversation
|
@akash8843 |
|
Could you also add test coverage for the changes you have made. |
…lf of another provider
9836d4f to
14096b9
Compare
|
|
@emphor11 , @suubi-joshua Thanks for the review. The backend permission enforcement for placing retrospective orders on behalf of another provider has been completed. This PR includes:
All tests are passing locally. Please let me know if any further refinements are needed. |



Description
While working on RDE-related order flows, I noticed that during retrospective order creation, there is currently no explicit permission check when an order is placed on behalf of another provider.
This PR adds a small but important authorization check to handle that case more safely.
What this PR changes
PLACE_ORDERS_ON_BEHALFOrderServiceImplduring retrospective order savingAPIExceptionis thrown if the privilege is missingThe existing behavior remains unchanged for normal (non-retrospective) order flows.
Why this is needed
In real-world RDE workflows, retrospective data entry is often done by data entry staff, not clinicians.
Without an explicit privilege check, any authenticated user could place orders on behalf of another provider, which does not feel safe or intentional.
This change makes that behavior explicit and configurable through roles and privileges.
Issue
Notes
This PR focuses only on backend enforcement. A follow-up frontend PR can handle hiding or disabling RDE-related UI elements based on the same privilege.