Goal

To keep the stock scope simple for 3.1, the goal is to follow the pattern in Requisition to create similar Rights (permissions) that will be used by Stock in 3.1. This includes using the existing Requisition Groups, Supervisory Nodes, and applying facility-specific permissions. This wiki page was originally created to design that in response to ticket .

See the Role Based Access Control page for more background on the different types of rights and roles.

Rights and Roles

STOCK_INVENTORIES_EDIT (supervision type):
A user with this right can create a physical inventory and can submit a physical inventory within a specific Program and HomeFacility/Node. What we mean by "HomeFacility/Node" is that this right, just like any supervision type right, is assigned for a single Program along with either the users home facility or a supervisory node. If assigned for a Supervisory Node, the permissions apply to all facilities below that node in the hierarchy. The right only works with a single Program. So if a user should have permissions to conduct physical inventories for multiple programs, you would need to assign the right individually for each program to that user.

Applies to:

STOCK_INVENTORIES_VIEW (supervision type):
A user with this right gets view permissions to view (and print) any submitted and past/historical physical inventories with a specific Program and Node. This right does not give users the ability to view drafts.

Applies to:

STOCK_ADJUST (supervision type):
A user with this right can make a stock adjustment, potentially altering the SOH, for any Orderable that is part of a specific Program and HomeFacility/Node.

Applies to:

STOCK_CARDS_VIEW (supervision type): 
Can view all the stock cards and line items for any Orderable that is part of a specified Program and HomeFacility/Node.

Applies to:

STOCK_CARD_TEMPLATES_MANAGE (admin type): 
Can configure the stock card template.

Applies to:

STOCK_SOURCES_MANAGE and STOCK_DESTINATIONS_MANAGE (admin type): 
Can configure the valid sources and destinations for all programs/facilities in the system.
Assumption: since this functionality is not in v3.1 scope, it may be removed or disabled before release.

STOCK_CARD_LINE_ITEM_REASONS_MANAGE (admin type):
Can configure the reasons, including which reasons map to which facilityTypes and programs.

ORGANIZATIONS_MANAGE (admin type):
Cane configure the list of outside organizations.
Assumption: since this functionality is not in v3.1 scope, it may be removed or disabled before release.

If this is kept for v3.1 release, please rename this right to STOCK_ORGANIZATIONS_MANAGE.


Rights to Remove

A handful of STOCK_* rights are already built into the bootstrap data, but we suggest removing them for 3.1:

No Permissions Checks

These endpoints will be visible to all logged-in users (no rights need to be checked other than a valid login token):

NOT in v3.1

Open Questions

  1. Do we need any other mechanisms for users to see across multiple programs? or across multiple facilities? The scheme would require assigning multiple rights if the user needed permissions to multiple facilities. The scheme above would involve using supervisory nodes to give permissions to multiple facilities (any section of the supervisory hierarchy).
    1. Proposed Answer: This is good enough for now. It is a little clunky, because there is no way to say "assign this user for ALL programs at Facility X". But that's okay.
  2. We are not sure if some existing code has endpoints that are were removed from scope during the workshop. For example, the stock card template feature was already built, and there is an endpoint for it, but we are not sure if it is in scope for v3.1 or not. Another example is the valid destinations endpoint, which is only needed for Issue/Receive functionality.
    1. Proposed Answer: Remove the endpoints from the RAML before the release. That way they will not be registered by Consul. The code will be there (in Java source), but nobody can hit those endpoints.