SCRITTURA: Customising JSPS according to user Role

  • KM03130528
  • 26-Mar-2018
  • 26-Mar-2018

This document has not been formally reviewed for accuracy and is provided "as is" for your convenience.

Summary

This article addresses how to customise JSPS according to user role

Question

Sometimes it is neccessary to tailor a JSP so that certain links and regions of the page are only accessible to certain users.  This article addresses how to do this .

Answer

The way to do this is to add code sections like this to the JSP , which make use of the isUserInRole method, part of the built in HttpServletRequest API used by jsps

eg :


% if(request.isUserInRole("admins") )
                                { %>
<display all the links>

% if(request.isUserInRole("reviewers") )
                                { %>
<just display some of the links t>



Please note that any changes to a custom jsp also require a full build using client full

As with all changes users are strongly advised to make all changes and thoroughly test them in a test environment first.