Re: Roles and Privileges Sprint

4 views
Skip to first unread message

Burke Mamlin

unread,
May 9, 2012, 1:29:53 PM5/9/12
to d...@openmrs.org
(bringing this conversation about preparing for the Roles & Privileges sprint onto the dev list)

Reviewing the notes on Roles & Permissions section from Jembi & PIH, it looks like there are some fundamental improvements requested:
  • Ship OpenMRS with pre-defined roles
  • Better documentation on managing roles (avoiding pitfalls)
  • More informative handling of privilege exceptions (make it easier to understand where/which privileges are missing)
  • Data-level permissions (restricting access to specific data based on privileges)
We've had prior conversations about improving roles/privileges:
  • Avoiding the common pitfall of conflating organizational roles (job title) with application roles (authorization within OpenMRS); they may align early on in simple systems, but exceptions are common over time or as a a system grows.
  • Creating privilege groups vs. programmatically defined roles – e.g., a web page wants to limit access to those who have a set of privileges.
  • Introducing location-based privileges
There seem to be some potential short-term wins that could be done in the sprint:
  • Improve our documentation to better introduce people to roles & privileges and cover the common pitfalls.
  • Improve privilege error messages in core and/or create a module that makes it easier to troubleshoot privilege errors (e.g., log all privilege checks during an operation and present the unique list of privileges and/or roles that would cover the operation, allowing someone to step through a workflow as superuser and then see the list of privileges required to complete the workflow).
  • Come up with some basic application roles that can be pre-defined within OpenMRS (ship with the application)
  • Design (and, if possible, implement) an approach for privilege groups or system roles (i.e., uneditable sets of privileges that applications can program against)
Data-level privileges (limiting access to data based on privileges) would be a terrific addition, but I'm afraid it will take more design that we can muster between now & the beginning of this sprint.  Maybe we could come up with some small but useful first attempts at solving this problem (e.g., a module requiring permissions to access certain observations … or a module that limits access to specific patients based on permissions).

Cheers,

-Burke

On Wed, May 9, 2012 at 9:49 AM, Burke Mamlin <bu...@openmrs.org> wrote:
Looking back at notes from AMPATH, the only reference to anything close to roles & privileges I found was the desire for the Data Entry Statistics Module to have a basic view privilege that allows a data assistant to see only his/her own statistics.

-Burke


On Wed, May 9, 2012 at 9:44 AM, Ben Wolfe <b...@openmrs.org> wrote:
Dawn found this link for me:
http://notes.openmrs.org/2012-roadmap

Is has the (mostly raw) notes from the calls we had with Jembi/PIH/AMPATH.

Daniel, can you tease out the topics from that and the other text below in the next 4 hours?

Ben

Dave Thomas

unread,
May 9, 2012, 2:51:05 PM5/9/12
to d...@openmrs.org
If i can weigh in on a discussion of roles and privileges briefly, I've found (and maybe things are improved in versions greater than 1.6.x) that we've run into trouble when a privilege is used both at the api and web layer.  This happens when we want to hide something in the UI that is wrapped in a <privilege/> tag, but then when we remove that privilege for a user, it turns out that the same privilege was wrapped around a couple of API methods, causing unexpected and hard-to-track-down UI problems across all of openmrs.

If there's a dedicated pass at roles+privileges, has there been any thought to separating api privileges from ui privileges?  I kind of feel like this is low-hanging fruit.  This wouldn't even need re-architecting, maybe just privilege naming conventions?

Or is the general sense that this type of problem has disappeared in newer versions?

d


Click here to unsubscribe from OpenMRS Developers' mailing list

Mark Goodrich

unread,
May 9, 2012, 3:55:26 PM5/9/12
to d...@openmrs.org

+1 for this.  We’ve run into issues with this a lot.  For instance, say you have a user who should not be able to view patients, but should have access to a report of aggregate patient data that calls getPatients() behind the scenes to perform the necessary calculations.  If you take away the “view patient” privilege from the user, they’ll get a stack trace when they attempt to execute the report.

 

This issue has been prevalent enough for us that we basically are unable to use privileges and roles for access control …

 

Mark

Dave Thomas

unread,
May 9, 2012, 4:16:48 PM5/9/12
to d...@openmrs.org
Right.  At PIH Rwanda, we've been able to lock down a few things, but we've only been truly successful with using roles/privileges in modules where we own the source code.  There's still too much UI exposed to people who don't need to see it, and we can't selectively turn off UI components without unintended consequences.

d

Bob Jolliffe

unread,
May 9, 2012, 4:22:10 PM5/9/12
to d...@openmrs.org
A step below data level privileges is encounter based privileges,
which sometimes can be used as a "reasonably" effective workaround to
some of the data access privileges wishes. If there is any discussion
to be had, would be good to consider this.

Burke Mamlin

unread,
May 9, 2012, 4:43:31 PM5/9/12
to d...@openmrs.org
Mark,

This is an interesting point.  Your example helps me understand Dave's point and suggests that we should distinguish between "Access Patient Data" and "View Patient Data" – i.e., the use of "View" in the privilege term describing API-level access to data per our conventions implies that getting data at the API level also means that the user should be able to view it within the application, which is not always the case.  In your example (a person being able to view aggregate patient data without viewing individual patient records), we have two choices:
  1. Grant the user "Access Patient Data" as the API-level privilege, meaning that they would be permitted to execute API calls that return patient information, but would not imply that the application should let them view the data directly.
     
  2. Allow the methods that need to access patient data to proxy privileges for the user.
The first seems like the better option to me.  Proxying privileges seems like a hacky way to override privileges that are there for a reason.  The first option will take some effort (maybe more than the upcoming sprint can muster), but seems like a better long-term solution.  Maybe we can come up with a way to start heading that direction.

-Burke

Mark Goodrich

unread,
May 9, 2012, 5:20:42 PM5/9/12
to d...@openmrs.org

Yeah, #1 is the solution that seems to make the most sense.

 

There are lots of examples of this, especially as you start adding your own custom modules.

 

Mark

Dave Thomas

unread,
May 9, 2012, 5:33:49 PM5/9/12
to d...@openmrs.org
Burke, sorry for not being clear before.  I think what you said in #1 is pretty much what i'm asking for.

The terminology can be worked out (to use your example 'Access' could imply API-level privileges, and 'View' could imply app-level privileges), but the important thing to me would be to not have 'Access Patient Data' sometimes be applied at the API level and sometimes applied at the app level.  With 'Access Patient Data' used at both the API and app layers, if I restrict 'Access Patient Data' for a user, it is incredibly difficult to tell what i've actually restricted.  This is when pieces of the application, other than the one I was trying to restrict, start throwing errors unexpectedly (per mark's example).

Part two of this argument (and maybe this is a different discussion) would be that once there was a clear distinction between api and app level privileges, the app level privileges could start to reflect actual UI components a little more.  If each portlet on the patient dashboard had its own privilege for example, like 'view regimen tab', the UI would be a LOT more easy to customise in a meaningful way using privileges and roles.

d

Darius Jazayeri

unread,
May 9, 2012, 8:24:57 PM5/9/12
to d...@openmrs.org
All dashboard tabs do have application-level privileges already. At least in 1.9.x, patientDashboardForm.jsp has:
<openmrs:hasPrivilege privilege="Patient Dashboard - View Overview Section">
<openmrs:hasPrivilege privilege="Patient Dashboard - View Regimen Section">
<openmrs:hasPrivilege privilege="Patient Dashboard - View Visits Section">
<openmrs:hasPrivilege privilege="Patient Dashboard - View Encounters Section">
<openmrs:hasPrivilege privilege="Patient Dashboard - View Demographics Section">
<openmrs:hasPrivilege privilege="Patient Dashboard - View Graphs Section">
<openmrs:hasPrivilege privilege="Form Entry">

However looking at patientOverview.jsp I see we refer to the underlying API-level privileges:
<openmrs:hasPrivilege privilege="View Patient Programs">
<openmrs:hasPrivilege privilege="View Relationships">
<openmrs:hasPrivilege privilege="View Allergies">
<openmrs:hasPrivilege privilege="View Problems">

Seems like we should write a ticket to:
  1. introduce new privileges like "Patient Overview - View Programs Section", etc
  2. use those in all dashboard portlets rather than the API counterparts
  3. do a liquibase changeset so that every role that has "View Patient Programs" also gets "Patient Overview - View Programs Section", etc. (That way nobody loses the ability to see something they currently see.)
Dave, would that help?

Daniel, want to do this?

-Darius

Dave Thomas

unread,
May 10, 2012, 2:16:26 AM5/10/12
to d...@openmrs.org
First I apologise for using the dashboard as an example -- it was hypothetical, and therefore crappy.  

And yes, your suggestion is exactly right, but it's a pattern that I think should be applied globally, and not just to the patient dashboard components.

Here's another example:  'View Concepts' is required by gutter.jsp to show the Dictionary gutter item.  There's no reason why our data officers or lab technicians need to be looking up concepts through the UI.  They just need to be able to fill out forms and look at patient records for data quality.  We've also had instances where research staff have looked for Concepts associated with specific forms without really knowing the correct way to do this, which resulted in bad data being exported.  Without access to the Dictionary, they would have been forced to ask us for help.

So there are a couple of groups of people for whom i'd like to hide the Dictionary gutter item.

But if you take away 'View Concepts' for a user, this basically breaks all of OpenMRS for that user.  More than 1/2 the ConceptService requires this privilege.

This is kind of an extreme example in terms of the functionality that would be lost by removing the privilege.  I feel like we've run into more subtle 'accidental' restrictions mistakes that might only manifest themselves in 1 or 2 unexpected places, sometimes in a module, or maybe in the various reporting mechanisms we've used.

What i think would be a good step forward would be a complete separation between privileges used by the app layer and privileges used by the api, which I think could be handled through naming conventions for privileges.  This doesn't require any new architecture, but would greatly increase the granularity of what you can restrict and for whom.  Privileges used concurrently in app and api layers are too blunt of an instrument, and lead to (sometimes strikingly) sub-optimal role configurations.

I know that increased granularity seems like it would lead to greater complexity for implementations, but i'd argue that at least in our experience its the opposite.

Does this make sense?

d

Darius Jazayeri

unread,
May 10, 2012, 2:49:14 AM5/10/12
to d...@openmrs.org
This makes perfect sense. And I agree that we can handle this merely by using a naming convention. For sake of not changing the names of the bulk of existing privileges (and privilege.name is the pk of that table), I propose that we go with:

(api-level privileges, stick with the same naming)
  • View Xyz (for metadata and data)
  • Manage Xyz (for metadata)
  • Add Xyz, Edit Xyz, Delete Xyz, Purge Xyz (for data)
(application-level privileges, follow the pattern from patientDashboardForm.jsp)
  • Page Name - View Xyz Section

(Ironically patientDashboardForm.jsp is the only jsp page I'm aware of where we've actually done this right. So yes, good choice of example. :-) )

So, I guess the proper solution is to look at all of our jsp and jsp-like files (.tag, and anything else?) for <openmrs:hasPrivilege, and identify every one of those in core (and ideally also bundled modules) that uses an API-level privilege. (This will be 90% of them.)

Then, for this list of privilege checks, we need to:
1. create a new, matching application-layer privilege
2. switch the jsp to check against the new privilege
3. write a liquibase changeset that will grant the new application-level privilege to every role that has the old api-level privilege.

-Darius

Burke Mamlin

unread,
May 10, 2012, 8:44:40 AM5/10/12
to d...@openmrs.org
I don't think privileges should be named after pages; rather, they should be named according to application behavior (i.e., function).  If we adopt a "Page Name - View Xyz Section" convention, then we'll end up with a whole bunch of unnecessary privileges.  For example, if there are fourteen pages between core & modules that present a list of allergies, then we don't want to have to manage 14 privileges to see allergies; rather, all of the pages should use a single privilege that is specific to displaying allergies to the user.

The fundamental problem is that we chose "View" in our API privileges.  How about getting the list of all "View Xyz" privileges and doing a global search & replace like s/View (Abc|Def|Ghi|…|Xyz)/Access $1/g.  Seems like a decent task for a roles & privileges Sprint.  Then we can use "View Patient" for, well, viewing a patient, no matter which page or which context.

-Burke

Mark Goodrich

unread,
May 10, 2012, 9:53:28 AM5/10/12
to d...@openmrs.org

+1 for renaming “View” to “Access” (or perhaps even “Get”?), as “viewing” really makes no sense in the context of an API and confuses the issue.  I think it would make sense to have the API level privileges mimic the names of the underlying methods as much as possible.  I’d also suggest perhaps starting the privilege with the name of the domain object and/or service, like “Concept – Access”.  I’ve always found it annoying when I’ve had to search through the alphabetized list of privileges looking for all the privileges that apply to a certain domain object.

 

I’m not quite sure where I fall on naming privileges after pages… but I think I’m in favor of it.  I see Burke’s point, but organizing it via page allows us a fairly detailed level of granularity which could be valuable.  You might want to a typical user to see one allergy list but not another… I guess the issue here is that we are using “privileges” as really a means of customizing the site based on role, rather than to define an actual privilege.

 

Mark

Burke Mamlin

unread,
May 10, 2012, 11:41:02 AM5/10/12
to d...@openmrs.org
Is there a way that we could rename "View *" privileges in the API and survive it?  I could easily see how a global search & replace would work for the core code, but I'm not sure what the ramifications might be for modules trying to span this change.  Is there a way we could ease their pain?

The thing I don't like about page-specific privileges as a convention is that it promotes making multiple privileges for the same thing, which would mean exchanging the current problem for another (i.e., we don't use privileges because a single privilege is used to mean two things → we don't use privileges because there are too many privileges to assign to do one thing).

-Burke

Darius Jazayeri

unread,
May 10, 2012, 12:36:12 PM5/10/12
to d...@openmrs.org
If we want to backport this (which I hope we do) rather than just fixing it in 1.10, I don't think it's feasible to rename all the "View" privileges in the API. Because we'd end up with modules needing to test different privileges in 1.8.3 vs 1.8.4.

Though I suppose we could rename "View Xyz" to "Access Xyz", not use "View Xyz", and have our hasPrivilege method silently translate "View Xyz" to "Access Xyz". (At first thought I like this idea.)

Regarding naming of application-level privileges, the current example we have is "Patient Dashboard - View Regimen Section".

I like this more than renaming that to something more generic like "Enable Regimen Workflows". And since the driving request is that implementers want to be able to customize exactly what specific users see, it seems appropriate to do this at the page level.

I'm not saying these should strictly always be "Page Name - Function in Page". I think we'd also want application-level privileges for higher-level workflows that get used by a group of pages.

Let's take another example: the Find/Create Patient page currently checks for "Add Patients" to see if it should show the Create Patient box. I think we should change this to test for "Find Patient Page - Allow Creating Patients". And other pages that optionally allow creating patients would get their own privilege for it, rather than having a generic "Create Patients in Application" privilege that controls all those pages.

-Darius

Dave Thomas

unread,
May 10, 2012, 1:34:03 PM5/10/12
to d...@openmrs.org
Hi.

To be clear, I don't think that we necessarily need (or want) to have a privilege wrap every single UI component.  If we think of the UI as a set of apps, i think if a given 'app' doesn't make sense without all of its widgets, then there should just be a single privilege giving access to the app.  There's still plenty of room for judgement calls about how to slice up the UI in the most meaningful ways.  Again, i'm really just asking for single privileges not to span both the API and app layer.  Once this happens, the UI can be wrapped in privileges that make the most sense, functionally.  I also think that this will take some fine-tuning over time.

@Darius, i think something should happen with 'Manage' also, but maybe this is a little less intuitive.  It logically makes sense to not show a user a 'create concept' page if they don't have 'Manage Concepts'.  But i still think that in the long run, separating app and api privileges here are correct.  Offhand, a use case would be allowing someone to only save changes to metadata associated with a specific clinical area.  This would be exposed by a module.  Or maybe if someone wanted to write a module that allowed users to add translations to concepts, but you might not want users of this module to be able to create new concepts... something like that.

d

Daniel Kayiwa

unread,
May 10, 2012, 5:22:01 PM5/10/12
to implem...@openmrs.org, dev
Greetings to you all!!!


We are soon going to have a sprint on roles and privileges, during which we are thinking of dealing with the following topics:


1) Make it easy for an admin to see what privileges are needed to perform a sequence of actions. 

2) Improve the page a user sees when they fail a privilege check.

3) Improve documentation on how to use privileges/roles and avoid pitfalls.

4) Implement Organizational Role as designed in this wiki page: https://wiki.openmrs.org/display/docs/Organizational+Roles


Do you feel the above topics address what the community needs, as far as roles and privileges are concerned?

Does anyone want a modernized version of the Restrict By Role module?

Do you have anything to say about the Organizational Role API design?


All questions, comments and suggestions are very welcome!!!


Daniel Kayiwa

On Behalf of the OpenMRS Community



--
The greatest want of the world is the want of men—men who will not be bought or sold, men who in their inmost souls are true and honest, men who do not fear to call sin by its right name, men whose conscience is as true to duty as the needle to the pole, men who will stand for the right though the heavens fall. 

Sateesh Babu

unread,
May 10, 2012, 9:41:51 PM5/10/12
to d...@openmrs.org
Can implementing the corresponding REST API's be made part of the same sprint. I see that there is a separate activity going on to define the REST API, but it would be good to consider the REST part with the functional part, like here related to the roles/privileges

--
Sateesh

Friedman, Roger (CDC/CGH/DGHA) (CTR)

unread,
May 11, 2012, 8:01:48 AM5/11/12
to d...@openmrs.org

I don't think it's a good idea to have a separate organizational role table, and I don't think this proposal has been thought through thoroughly.

 

I'd like to review some of the discussion that took place last spring around the HR module.  At that time, what was on the table was the separation of organizational roles from privileges by breaking the link between users and providers.  At that time, I proposed that the distinction be between staff and users, and intended to use the providers table as a staff table.  However, this was strongly opposed by Burke and others on the grounds that providers were only those who provided services to patients and that other staff should be excluded.  I was told that the use of the providers table for other staff would not be welcome, and the HR module was developed with different core table, staff, linked to person.

 

As I read the wiki page, the proposal addresses several issues:

 

* People are still confusing organizational roles with system privileges.  This problem has already been solved by the split between user and provider, an organizational role provider attribute would suffice to handle issues such as the letters going out with the wrong signature.

 

* There are functional distinctions between providers of the same provider type which should be available for selecting pick lists.  This can also be addressed by provider attributes or tags/categories. 

 

* People are being miscategorized for administrative reporting (doctors/PAs/nurses).  During the HR discussion, the point was made repeatedly that administrative reporting was outside the scope of an EMR.  To the extent that a provider attribute would not suffice, this should bring the whole issue of the role of OpenMRS in administrative reporting back into play.

 

* People have different organizational roles at different locations.  This issue is addressed only in the data model by having a location attribute; it is not addressed in the text.  I can imagine the following possible uses: it is intended to be used for location-based data access privileges (reconflating organizational role and user privilege); it is intended to be used for location-based limitations on pick lists; it is intended to make organizational reporting more useful.  If it is the third use that is motivating the change, and administrative reporting is on the table, then I would urge people to take a look at the data model for the HR module (hr3.mwb (mysql workbench) on the HR module project page).  There, the issue is dealt with more generally (based on multi-country requirements analysis) with the concepts of post and assignment: the post is the official job title and the organizational unit of which the staff is a member, while an assignment is an organizational role; there can be multiple assignments per post, so the same staff can work as a PA at location 1 on Monday and a CHW at location 2 on Tuesday.

Daniel Kayiwa

unread,
May 16, 2012, 11:41:36 AM5/16/12
to implem...@openmrs.org, d...@openmrs.org

Hi James,

We shall not deal with TRUNK-1640 during GSOC because it will broaden the scope more than what the student is expected to cover in that limited time.

However, i see it fitting in next week's Roles and Privileges Sprint.
So i think we could consider it as part of what we are going to deal with during that sprint.

What do others think?


On Mon, May 14, 2012 at 3:21 PM, James Arbaugh <jarb...@hashaiti.org> wrote:

Hi Darius,

 

Thanks for setting me straight.  I confused the “Restrict By Role Module” with the “Restrict By Encounter Type Module” by the HISP India group which would address the needs of TRUNK-1640.  We do NOT need the “Restrict By Role Module”.

 

I recently added TRUNK-1640 as “Extra Credit” on the Filtering Forms on Dashboard Design Page because it’s related. The GSoC main project is to limit which forms appear in the list of forms that can be filled out.  TRUNK-1640 is to limit which role is required for given encounter types to be viewed/edited.  https://wiki.openmrs.org/display/docs/Jembi+Html+Form+Entry+Module

Roles Based Form Display

On the form designer, roles can be associated with forms. Roles associated with a form can either be associated as a "View" role or an "Edit" role (or the equivalent "Both" role). On the patient dashboard, if there are roles associated with a form, then the currently authenticated user must have the appropriate roles to view and/or edit a form.

Can we make TRUNK-1640 an official requirement for the GSoC project?  Or is that something that can be addressed through the Roles and Privileges Sprint?

 

Thanks,

James

 

From: implem...@openmrs.org [mailto:implem...@openmrs.org] On Behalf Of Darius Jazayeri


Sent: Thursday, May 10, 2012 7:19 PM
To: openmrs-i...@LISTSERV.IUPUI.EDU
Subject: Re: [OPENMRS-IMPLEMENTERS] Roles and Privileges Sprint

 

About filtering things by roles...

 

Filtering forms by roles and patient characteristics is a GSoC project this year (https://wiki.openmrs.org/x/OIW5AQ, student = Goutham Vasireddi) so we will not be working on that during the sprint. (But yes, we know it's highly voted and much awaited!)

 

The Restrict By Role module allows you to use Cohort Builder queries to limit the patients a given Role can see. As far as I know, this is the only published module that lets you limit the patients that particular users are allowed to see, although that's a frequently-requested feature. This was a very early module (from 2007), so the code is mediocre, it probably slows down your patient searches a lot, and the API has changed since then so it probably misses a lot of restrictions.

 

[The reason there aren't any other published modules doing this is that it's basically impossible to solve the problem generically in a performant way.)

 

So the question is: are there any implementers out there who would like to see us spend some developer cycles doing a modernized version of Restrict By Role? It would:

  • let you restrict the patients that particular users/roles can see based on reporting module cohort queries (instead of cohort builder)
  • cache query results so it slows things down less than the current module does

If there's interest, we can spend some cycles on this during the sprint. (And if not, not.)

 

-Darius

 

On Thu, May 10, 2012 at 3:22 PM, James Arbaugh <jarb...@hashaiti.org> wrote:

Greetings all! 

 

One of our highest priorities should be the RestrictByRole module capability; the ability to specify which user roles can view/edit which encounters.  This is important to many based on the number of people that have voted (6) for the “Add roles-based form display feature ticket”…

https://tickets.openmrs.org/browse/TRUNK-1640

…which includes the ability to “filter form viewing and editing based on roles”.

 

This is also something that comes up frequently on the mailing list and on OpenMRS Answers.

https://answers.openmrs.org/questions/585/a-way-to-set-role-privileges-to-specific-form-entry-forms

 

+1 on improving documentation

 

Thanks,

James

 

From: implem...@openmrs.org [mailto:implem...@openmrs.org] On Behalf Of Daniel Kayiwa


Sent: Thursday, May 10, 2012 5:22 PM

To: openmrs-i...@LISTSERV.IUPUI.EDU
Subject: [OPENMRS-IMPLEMENTERS] Roles and Privileges Sprint

 

Greetings to you all!!!

 

We are soon going to have a sprint on roles and privileges, during which we are thinking of dealing with the following topics:

 

1) Make it easy for an admin to see what privileges are needed to perform a sequence of actions. 

2) Improve the page a user sees when they fail a privilege check.

3) Improve documentation on how to use privileges/roles and avoid pitfalls.

4) Implement Organizational Role as designed in this wiki page: https://wiki.openmrs.org/display/docs/Organizational+Roles

 

Do you feel the above topics address what the community needs, as far as roles and privileges are concerned?

Does anyone want a modernized version of the Restrict By Role module?

Do you have anything to say about the Organizational Role API design?

 

All questions, comments and suggestions are very welcome!!!

 

Daniel Kayiwa

On Behalf of the OpenMRS Community

 


Click here to unsubscribe from OpenMRS Implementers' mailing list

 


Click here to unsubscribe from OpenMRS Implementers' mailing list


Click here to unsubscribe from OpenMRS Implementers' mailing list



--
If we keep uppermost in our minds the unkind and unjust acts of others, we shall find it impossible to love them as Christ has loved us; but if our thoughts dwell upon the wondrous love and pity of Christ for us, the same spirit will flow out to others.

Darius Jazayeri

unread,
May 16, 2012, 7:08:59 PM5/16/12
to implem...@openmrs.org, dev
Hi Implementers and Devs,

James has been pushing for TRUNK-1640 to be included in next week's sprint (and I don't blame him--it has 6 votes!). But on today's design call, we looked at the proposed solution in that ticket, and we're not comfortable introducing it into the codebase with the given design.

In particular, it wants to create a form_role table that links forms to the roles that are allowed to enter/edit them.

Instead, we have a counter-proposal, which I've ticketed at TRUNK-3361. Instead we would add a form.entry_privilege column, so a sysadmin can create a privilege for entering a particular form, and assign it to whatever role or roles they choose.

James & others: would this solve your use case? If possible please comment on the ticket. (I'm emailing this to both the implementers and dev lists, so you won't all necessarily get each others replies.)


-Darius

On Wed, May 16, 2012 at 3:12 PM, Ben Wolfe <b...@openmrs.org> wrote:
Looking at it briefly TRUNK-1640 looks very similar to what is on slate for the gsoc project. Both are linked to forms, not to encounter types.  

Ben

Darius Jazayeri

unread,
May 17, 2012, 5:23:54 PM5/17/12
to dev, implem...@openmrs.org
(Sending to the dev list, since my reply is more dev-focused.)

This makes a lot of sense to me, both as a use case, and as a way to approach it.

At first thought, it seems to me that the following would be pretty easy to implement:
  • Add two properties to EncounterType: viewPrivilege and editPrivilege
  • in the db those would be encounter_type.view_privilege and edit_privilege (varchar references privilege)
  • The encounters dashboard tab would need to respect viewPrivilege when deciding what encounters to display
    • can we build this into the paged hibernate query we're using, though?
  • Same goes for the visits dashboard tab
  • Same goes for the encounter search widget, and the manage encounters admin page
Assuming the hibernate query is tractable, and assuming people generally agree with this design, I could see this fitting into the sprint...

-Darius

On Thu, May 17, 2012 at 1:52 PM, James Arbaugh <jarb...@hashaiti.org> wrote:

Hi All!

 

I have commented on TRUNK-3361 and had a short call with Darius to explain the use-case that we are trying to solve.  It has more to do with requiring permissions for viewing/editing encounters than it does to what users can fill out a given form. So, after a form has already been filled out (which we’ll called an encounter at that point and is shown under the encounter/visit tab on the dashboard).  Who has permissions to view it and/or edit it?  So for example, we need to limit the viewing/editing of Blood Bank  encounters to only users of the Blood Bank.  And we need to limit the editing of Lab encounters to only Lab Technicians, but they can be viewable by doctors.  And we need to limit the editing of surgery encounters by Surgery data entry clerks and surgeons, but all doctors can view them.  If a user isn’t going to be able to view/edit the contents then it need not appear in the list of encounters.

 

The view and edit role and/or privileges could be implemented on the Edit Encounter Type page rather than on the Edit Form page.  The consideration of doing it on the Edit Form page instead would be if someone needed to limit viewing/editing of forms in the case of different forms that use the same type of encounter.

 

Thanks for your patience and willingness to help make this needed functionality a reality.

Friedman, Roger (CDC/CGH/DGHA) (CTR)

unread,
May 18, 2012, 7:16:33 AM5/18/12
to d...@openmrs.org

Darius --

     Wouldn't it make sense at the same time to make privilege a standard OpenMRS data object?  At present, it does not have an integer id field or audit info.

Saludos, Roger

 

From: d...@openmrs.org [mailto:d...@openmrs.org] On Behalf Of Darius Jazayeri


Sent: Thursday, May 17, 2012 5:24 PM
To: openmrs...@LISTSERV.IUPUI.EDU

Click here to unsubscribe from OpenMRS Developers' mailing list

Ben Wolfe

unread,
May 18, 2012, 8:59:15 AM5/18/12
to d...@openmrs.org
The design sounds good to me.

Roger, the solution might be to have a "X number of encounters are hidden" shown on some screens.  Or would that be giving away too much information?

I don't think we should muddle in adding a privilege.id with this.  If desired, that can be a later refactoring. (My vote will be that its not needed though)

Ben

Darius Jazayeri

unread,
May 18, 2012, 5:34:14 PM5/18/12
to d...@openmrs.org

Burke did not want us to add privilege.ID because the privilege name _is_ the primary key in a business sense. And because they are referred to by name in code.

-Darius (by phone)

Friedman, Roger (CDC/CGH/DGHA) (CTR)

unread,
May 19, 2012, 10:32:07 AM5/19/12
to d...@openmrs.org

Yes, but now we would be adding 2 varchar fields to each encounter type.  And how’d you like the way things turned out with globalproperty under the same logic?

Ben Wolfe

unread,
May 19, 2012, 1:41:34 PM5/19/12
to d...@openmrs.org
We already have person_attribute_type.edit_privilege, so we have a precedent.  I am satisfied with how GP turned out. :-)

Ben
Reply all
Reply to author
Forward
0 new messages