Tuesday, July 3, 2012

Down the lane with OpenMRS in GSoC 2012-Part II

The next task i was assigned is,

2. Creating a new tag to restrict all (or part of) an HTML Form by role 


The <restrictByRole> tag is the next newcomer to the HTML tag base of Form Entry Module. This feature is concerned to be implemented in a way that, some user with a particular role can be restricted from either viewing a certain HTML form (or a section in the form) by using the <restrictByRole> tag. The tag comes with two attributes as "include" and "exclude" where you can mention the names of the roles for whom you want to include or exclude the form restriction.

As an example if you don't need to make a certain table in your HTML form to be viewable to a Person which has "Data Manager" role assigned to him/her, you form description would be as follows,

<restrictByRole include="Data Manager">                   
  <table>

   <tr>
       <obs conceptId="6100" labelText="Restricted for Data Manager"/>
   </tr>

  </table>
</restrictByRole>


So this table would not be shown to any person with the 'Data Manager' role but only to the users who belongs to that role.
In the same way this can be used with "exclude" attribute, in where the corresponding section would only be not restricted to the mentioned role.

An example form would be like,

1.0 These rows in the table are not restricted for the user Admin, who has "System Developer" role
2.0 If a user who is not a "System Developer" opens the form, if would look like this
That is where we are heading towards at the moment. There are two more tasks to do during the summer so i look forward for those also very enthusiastically!

No comments:

Post a Comment