Currently there is no way to limit which apps are shown on the homepage based on location. I.e. if an application is available for a user, it will be available regardless where they are logged in.
This should be changed so that apps can be limited to one or more locations, and so the link URL template can contain references to the session location.
- Currently, in HomePageController in the referenceapplication module we are not applying any "app context model". We need to have one. (You can see an example of this on the patient dashboard here: https://github.com/openmrs/openmrs-module-coreapps/blob/master/omod/src/main/java/org/openmrs/module/coreapps/page/controller/patientdashboard/PatientDashboardPageController.java#L87 )
- It should have currentUser, currentProvider, and sessionLocation properties, which should be compatible with the webservices.rest representation of those types.
- I suggest using the webservices.rest module's ConversionUtil to convert UiSessionContext to a SimpleObject (though you may need to copy those properties into a Map first)
- This will cause the "require" properties of homepage extensions to be evaluated in this new context (instead of in an empty one)
We should support all the following scenarios:
- Only show this extension if sessionContext.sessionLocation.uuid == (some uuid)
- Only show this extension if sessionContext.sessionLocation.tags has a tag with a certain name
- Only show this extension if sessionContext.sessionLocation.uuid is one of several UUIDs
- Only show this extension sessionContext.sessionLocation.uuid == (some uuid)