Welcome Page Customization For JasperSoft on the Basis of Roles

Posted on by By Sayali Mahale, in Business Intelligence, Databases, Jaspersoft, Open Source Business Intelligence | 0

On Welcome page of Jaspersoft, Login is based on Some Roles assigned to particular user ,as per that we have an access on Jaspersoft. If anyone wants to create their own user with Roles, they simply do it by making following changes in particular files.

Let us consider that we are creating following three different Users and Roles with some http://helicaltech.com/wp-admin/post.php?post=3624&action=editrequirement:

1)Create three different Users

i)Reports

ii)Dashboard

iii)Adhoc

2)Create three different Roles

i) ROLE_REPORT

ii)ROLE_ DASHBOARD

iii)ROLE_ ADHOC

3)Assign Role for each User As

i) For Report User Assign ROLE_ REPORTS

ii) For Dashboard User Assign ROLE_ DASHBOARD

iii) For Adhoc User Assign ROLE_ ADHOC

4) In MenuBar only View button should be their which contains only Repository option and for user other than above, it will show all Menus.

5)The Home page contains only three Containers which has only viewlist button at center

that is:

i)Reports

ii)Dashboards

iii) Ad Hoc Views

6) This three containers needs to be modified to display the text as:

i)Reports – Change the existing text to: Click on ‘View list’ to access all Reports in repository.

ii)Dashboards – Change text existing to: Click on ‘View list’ to access links to Dashboards.

iii)Ad Hoc Views – Change the existing text to: Click on ‘View list’ to access all AdHoc Views in Repository.

7) All text present in left side of Home Page will get removed.

Now we have do customization on JasperSoft to accomplish the requirement ,for that we requires to modify the following different files as below:

NOTE: After modifying the files, to see changes done on JasperSoft,it is important to firstly restart the tomcat-server, then and then only you are to able to see the changes.

1) To Grant the permissions for Users:

i)Navigate to the path : C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-pro\WEB-INF\jsp\modules\home

/* If this condition is true it redirects to HomePage1.js */<authz:authorize ifAnyGranted=”ROLE_REPORTS,ROLE_ DASHBOARD,ROLE_ ADHOC”><c:set var=”ModuleName” value=”home/HomePage1“/></authz:authorize>

/* Else it redirects to HomePage.js */

<authz:authorize ifNotGranted=”ROLE_REPORTS,ROLE_DASHBOARD,ROLE_ADHOC”>

<c:set var=”ModuleName” value=”home/HomePage“/>

</authz:authorize>

 

/*Insert this line to add variable created above*/

<t:putAttribute name=”moduleName”>${ModuleName}</t:putAttribute>

 

ii)In that homeForNonDemo.jsp contains code related to grant permissions for the user,so here we have to grant permissions to User Report,Dashboard,Adhoc as follows:

iii) Firstly restart the server, now you are able to logged onto server using different three  users that is Reports,dashboard,AdHoc.

 

2)To change the HomePage which contains HomeView:

i)After logged in with above users, it will redirects to HomePage1

ii)Goto C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-   pro\scripts\home

iii)In that create .js file same as HomePage.js,but make following changes in HomePage1.js, which we are already create as HomeView1.js as HomeView.js.

HomeView = require(“home/view/HomeView1“)

 

3)To change the HomeView which contains different views we have to change:

i)From HomePage1 it will redirects to HomeView1

ii)Navigate to path : C:\Jaspersoft\jasperreports-server-5.6\apache- tomcat\webapps\jasperserver-pro\scripts\home\view

iii)create HomeView1.js as HomeView,it is having Listview and WorkflowView,homeTemplate add the ListView1,WorkflowView1,homeTemplate1.js files created by us.

ListView = require(“home/view/ListView1“),WorkflowView = require(“home/view/WorkflowView1“),homeTemplate = require(“text!home/template/homeTemplate1.htm“),

 

4)To change the text which the container displays:

i)Goto C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-pro\scripts\home\view

ii)In that ListView1.js file we need to modify the text as:

render: function () {var nothingToDisplayElement;if (this.collection.length > 0){//cleanup only for ‘nothing’ msg, no listeners to remove herethis.$el.html(“”);

this.collection.forEach(_.bind(function(model){

var name = model.get(‘name’);

               console.log(model);

                if (name == ‘dataSource’ || name == ‘domain’) {return;}

                if(name == ‘dashboard’) {

                model.set(‘description’,’Click on View list to access links to Dashboards in repository’);}

             if(name == ‘adhocView’) {

                model.set(‘description’,’Click on View list to access links to Ad hoc Views in repository’);}
if(name == ‘report’) {

                model.set(‘description’,’Click on View list to access links to Reports in repository’);}

var view = new this.initOptions.listElementView({ model: model });this.subviews.push(view);this.$el.append(view.render().$el);

},this)).

}else{

nothingToDisplayElement = _.template(nothingToDisplayTemplate, {message: this._msgNothingToDisplay});

this.$el.append(nothingToDisplayElement);

}

 

return this;

}

 

 

iv)It will change the containers display text.

5)To change the click event of the Viewlist presents on the container:

i)Navigate to C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-pro\scripts\home\view

ii)Goto workflowView1,change the path of template and modify click event as:

template = require(“text!home/template/workflowTemplate1.htm“),events: {     “click .button.left”: “clickOnLeftButton”,”click .button.center“: “clickOnRightButton” },

iii)Now you are able to see Viewlist at Middle.

6)To remove ViewTutorial from Containers:

i)Goto to C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-pro\scripts\home\Template

ii)In workflowTemplate.html comment or remove the text which shows the ViewTutorial as

<!–{{ if (tutorialControl) { }}<a href=”{{- tutorialControl.entity.url }}” target=”_blank” >{{- tutorialControl.label }}     </a>{{ } }}–>

 

7)To Remove Left Side text from Home Page:

i)Navigate to var C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-pro\scripts\home\Template

ii) Having homeTemplate1.html in that comment or remove the following text as:

<h2 class=”homeSidebar-title” >{{- welcomeMessage }}</h2>

 

8)To display View Menu having only Repository option:

i)Goto /var/lib/tomcat7/webapps/jasperserver-pro/WEB-INF/decorators

ii) In decorators.jsp modify as follows and add assign menu.search,menu.all to administrator

<context name=”main_view_mutton” test=”checkAuthenticationRoles” testArgs=”ROLE_SUPERUSER,ROLE_ADMINISTRATOR,ROLE_REPORTS,ROLE_DASHBOARD,ROLE_ADHOC”> <selectAction labelKey=”menu.repository”>

 

9)To hide Library Menu From Jaspersoft for Above Roles As:

i)Goto C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-pro\WEB-INF\decorators

ii) In decorator.jsp modify it as:

<js:authorize ifAllGranted=”ROLE_ADMINISTRATOR”><li id=”main_library” tabIndex=”-1″ class=”leaf”><p class=”wrap button”><span class=”icon”></span><spring:message code=”menu.library”/>

</p>

</li>

</js:authorize>

It means we are hiding the Library menu for Above Roles but it is Visible to Role Administrator.

10)To optimize your javascript code we need make change in js.config.properties file which is present at path:

C:\Jaspersoft\jasperreports-server-5.6\apache-tomcat\webapps\jasperserver-pro\WEB-INF

But now we don’t know to create the optimized js code because of that we will keep it as false:

# Control default value of javascript optimization in runtimejavascript.optimize=false

 

 Thanks,
Sayali Mahale

logo

Best Open Source Business Intelligence Software Helical Insight is Here

logo

A Business Intelligence Framework

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments