UI with User Privileges — GSoC 2021 Week 8

Piumal Rathnayake
2 min readAug 4, 2021

During the week, the main thing I was focusing on was implementing the User Access Control System. Previously I had added the required privileges to the DHIS Connector Module. So this week I started updating the pages of the module to work according to the suitable privileges.

I’ll briefly explain how these privileges work. Let's take the Location Mapping UI as an example. It’s the first page I updated to work with the user privileges.

Location Mapping UI

There are 2 privileges related to Location Mapping UI.
1. View Location Mappings
2. Manage Location Mappings

I used <openmrs:require > tag and <onpenmrs:hasPrivilege> tag to load content according to the privileges. This is how the UI will work after adding the module privileges.

  • Users with Manage Location Mappings privilege (or both privileges) can edit or update mappings. They can simply change a mapping and save it.
  • Users with View Location Mappings privilege can only see the mappings. And those can’t be changed because the save button is removed and the dropdown lists are disabled.
  • Users who don’t have any of these 2 privileges can’t see the page or the link in the navbar. And they will be redirected to the login page if the user tries to access it by using the URL

Similarly I was able to update the other pages to work with the user privileges. You can see the details of those pages from these links.

And I sent those Pull requests. Those are still under review. I had to add some requested changes to those PRs and those will be merged soon.

Work vector created by stories — www.freepik.com

In the next week, I’m gonna do the necessary changes to the module documentation by adding the details of new features. And need to spent time improving the UX of the module.

--

--

Piumal Rathnayake

I'm a Computer Engineering Undergraduate at University of Peradeniya, Sri Lanka. And I also work as a software engineer at Sustainable Education Foundation.