Location Based Access Now with Roles

VANKINEENI TAWRUN
2 min readJun 17, 2019

--

Week 03 [June 10, 2019 — June 16, 2019]

Week3 was more of designing the User Role Based Access Feature to the Module and Fixing the Issues of LBAC-33 and Integrating it with OpenMRS Reference App.

Login Page

The Login Page requires User to Select Location Login for Logging into the System. The previous version of the app checks whether the LBAC module installed or not and accordingly displays the Login Locations Fragment if not installed or if the logging user doesn’t have a Location property. If the user has the location property then he is made to Logged into the location of his user property.

We changed this by Login in the user with the Location property with session location as his first location of the accessible location.

User Role Based Access

The main focus of Role based access is to make ease of assigning the locations to users. A Particular type of Doctor or a Nurse who are providers in the OpenMRS system belongs to a different set of Locations. So, Instead of assigning Multiple Locations to a new user whenever they are created we can directly assign the particular type of Role.

Basically, A Role is a set of privileges where each privilege has its own description and we use it accordingly to check if the user is allowed to perform the action or not.

boolean hasPrivilege(UserContext userContext, String  privilege) { 
return StringUtils.isBlank(privilege) || userContext.hasPrivilege(privilege);
}

Now, we use User Roles to get the Accessible locations of the User and to be able to access a location he should be having a corresponding privilege.

Deployment made Easy

Location Based Access control module can we be now installed easily

References

  1. https://talk.openmrs.org/t/gsoc-2019-location-based-access-control-phase-2/22147/85
  2. https://talk.openmrs.org/t/location-based-access-control-v0-1-0-released/19525/32
  3. https://github.com/openmrs/openmrs-module-referenceapplication/pull/57

--

--

VANKINEENI TAWRUN

Senior Undergraduate in Computer Science at IIT(BHU) Varanasi