Role Based White Labeling of Jaspersoft
As JasperSoft is an opensource tool , we can customize it as we want. Let’s consider if you want to hide any menu item for particular User Role , display some different name to particular menu item etc. , so we can easily achieve same in JasperSoft.
Let us see how we can achieve to customize Jaspersoft based on the user roles.
Following are some possibilities that in future you may want some customization changes in JasperSoft based on User roles.
- Replace the “Library” menu item with a “Reports” menu item.
Steps :
1. Go to path “C:\Jaspersoft\jasperreports-server-6.2.0\apache-tomcat\webapps\jasperserver-pro\WEB-INF\bundles\”.
2. Open jasperserver_messages.properties file and search for keyword “menu.library=Library”.
3. In this file , replace “menu.library=Library” with “menu.library=Reports”.
4. Save the file and restart the jasperserver .
5. Log in through any user other than superuser/jasperadmin , you can see the change.
- “Reports” menu item that displays the same screen the user is taken to when they select the “View List” link in the “Reports” section on the Jaspersoft home page.
Steps :
1. Go to path “C:\Jaspersoft\jasperreports-server-6.2.0\apache-tomcat\webapps\jasperserver-pro\scripts\bower_components\jrs-ui\src\”.
2. Open actionModel.primaryNavigation.js file and search for keyword “menu.library=Library”.
3. In this file , replace
“library : {url : “flow.html”, params : “_flowId=searchFlow&mode=library”},”
with
“library : {url : “flow.html”, params :
“_flowId=searchFlow&mode=search&filterId=resourceTypeFilter&filterOption=resourceTypeFilter-reports”},”
4. Save the file.
5. Log in through any user other than superuser/jasperadmin , and click on “Reports” menu item , which will get redirects to “View List” link.
Note : This is applicable when javascript.optimize=false in “js.config.properties” file present at location “C:\Jaspersoft\jasperreports-server-6.2.0\apache-tomcat\webapps\jasperserver-pro\WEB-INF\”.
- For ADMINISTRATOR role it should show the “Library” menu item instead of “Reports” menu item and get redirects to “Library” link on “Library” section on the Jaspersoft home page.
Steps :
1. Go to path “C:\Jaspersoft\jasperreports-server-6.2.0\apache-tomcat\webapps\jasperserver-pro\WEB-INF\bundles\”.
2. Open jasperserver_messages.properties file.
3. After that add the new property as “menu.library1=Library” in file to show “Library” menu item for superuser/jasperadmin and save the file.
4. Next open the decorator.jsp file present at location “C:\Jaspersoft\jasperreports-server-6.2.0\apache-tomcat\webapps\jasperserver-pro\WEB-INF\decorators\” and make the following changes under “<div class=”sectionLeft”>” tag.
5. Replace
<li id=”main_library” js-navtype=”actionmenu” role=”menuitem” class=”leaf hidden”>
<p class=”wrap button”><span class=”icon”></span><spring:message code=”menu.library”/></p>
</li>
with
<authz:authorize ifNotGranted=”ROLE_ADMINISTRATOR”>
<li id=”main_library” js-navtype=”actionmenu” role=”menuitem” class=”leaf”>
<p class=”wrap button”><span class=”icon”></span><spring:message code=”menu.library”/></p>
</li> </authz:authorize>
<authz:authorize ifAllGranted=”ROLE_ADMINISTRATOR”>
<li id=”main_library1″ js-navtype=”actionmenu” role=”menuitem” class=”leaf”>
<p class=”wrap button” onclick=”javascript:primaryNavModule.setNewLocation(‘library1‘);”>
<span class=”icon”></span><spring:message code=”menu.library1″/></p>
</li></authz:authorize>
6. Save the file and restart the jasperserver.
- Remove the “View” menu item for all other roles by default except Superuser or Jasperadmin roles.
Steps :
1. Go to path “C:\Jaspersoft\jasperreports-server-6.2.0\apache-tomcat\webapps\jasperserver-pro\WEB-INF\”.
2. Open actionModel-navigation.xml file and search for keyword “menu.library=Library”.
3. In this file ,change
“” with
“ ”.
By which , only user having role as ‘ROLE_ADMINISTRATOR’ is able to see the “View” menu item.
4. Save the file and restart the jasperserver .
5. The “View” menu item get hide for all users other than superuser/jasperadmin.
Best Open Source Business Intelligence Software Helical Insight is Here
A Business Intelligence Framework
Thanks,
Sayali Mahale