How to Remove Home Page and Filters Options in Jasper Server Pro

Posted on by By Nikhilesh, in Business Intelligence, Jaspersoft, Javascript, Open Source Business Intelligence | 4

How to Remove Some Items in Home Page & Some Filters Options Under View List Menu in Jasper Server- Pro-6.2 With Role-Based Security

Make data easy with Helical Insight.
Helical Insight is the world’s best open source business intelligence tool.

Changes for the Homepage 

Overview:

To Make the following changes to the Jaspersoft Homepage.

Implementation:

The feature should be implemented as follows:

    1. Remove the “Data Sources” item and its “View Tutorial” and “View List” links

    2. Remove the “Domains” item and its “View Tutorial” and View List” links

    3. Move the “Reports” item to the place where the “Data Sources” item had been (top left item)

    4. Move the “Dashboards” item to the place where the “Domains” item had been (top right item)

    5. Leave the “Ad Hoc Views” item in its current location.

1234

To Remove the following

1. Go to path C:\Jaspersoft\jasperreports-server-6.2.0\apache-tomcat\webapps\jasperserver-pro\scripts\home

and make a copy of HomePage.js and in its duplicate copy rename it as HomePage_snw.js(ur desired extension) and make some following changes

HomeView = require(“home/view/HomeView_snw”) –>set the path

2.Go to path C:\Jaspersoft\jasperreports-server-6.2.0_1\apache-tomcat\webapps\jasperserver-pro\scripts\home\view

and make a duplicate copy of HomeView to HomeView_snw

and make the following changes in the file

In // views –>make the following path to

ListView = require(“home/view/ListView_snw”),
WorkflowView = require(“home/view/WorkflowView_snw”),

In ListView_snw–> make the following changes :

var nothingToDisplayElement,adhocView; –>took a nnew variable adhocView

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

if (name == ‘dataSource’ || name == ‘domain’) {

return;

}

if (name === “adhocView”) {

adhocView = model;

return;

}

//To Arrange in order

if (adhocView) {

var view = new this.initOptions.listElementView({ model: adhocView });

this.subviews.push(view);

this.$el.append(view.render().$el);

}

In WorkflowView_snw-–> No changes required in this file just rename the duplicate file to the path

————————————————————————————————————————————————————–

C:\Jaspersoft\jasperreports-server-6.2.0_1\apache-tomcat\webapps\jasperserver-pro\scripts\home\template

in//Templates → make the path to

homeTemplate = require(“text!home/template/homeTemplate_snw.htm”),

In homeTemplate_snw.htm—>make the following changes

Add

—————————————————————————————————————————————————————

<div class=”homeSidebar”>
<h2 class=”homeSidebar-title” >{{- welcomeMessage }}</h2>
<!–Popular Links–>
<div style=”height:24px;”></div>
<!–Recently Viewed Items–>
</div>

<div class=”homeMain”>
<!–Workflows–>
</div>


Make data easy with Helical Insight.
Helical Insight is the world’s best open source business intelligence tool.

In homeForNonDemo.jsp make the following changes so that user wise and role wise security view is implemented

<authz:authorize ifAllGranted=”ROLE_ADMINISTRATOR”>

<c:set var=”bodyId” value=”home_admin”/>

</authz:authorize>

<authz:authorize ifNotGranted=”ROLE_ADMINISTRATOR”>

<c:set var=”bodyId” value=”home_user”/>

</authz:authorize>

<authz:authorize ifAnyGranted=”ROLE_SUPERUSER,ROLE_ADMINISTRATOR”>

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

</authz:authorize>

<authz:authorize ifNotGranted=”ROLE_SUPERUSER,ROLE_ADMINISTRATOR”>

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

</authz:authorize>

How to hide some menu items in the Filters as shown below.

12345

Method 1:

————–

Go to the following path

C:\Jaspersoft\jasperreports-server-6.2.0_1\apache-tomcat\webapps\jasperserver-pro\WEB-INF\jsp\templates

you will find list.jsp

In the file list.jsp make the folloing changes.

Add this

Here we granting displaying some list when heis user and displaying the whole when he is a Administrator or superuser and making some changes in css as following

Role based security and hiding of some items

———————————————————————–

<authz:authorize ifNotGranted=”ROLE_ADMINISTRATOR”>
<authz:authorize ifNotGranted=”ROLE_SUPERUSER”>
<style type=”text/css”>
#resourceTypeFilter_item4_SubList {

display : block !important;
}
#resourceTypeFilter_item4_SubList + .wrap.button.separator {
display: none;
}

.fewer launcher {
display: none;
}

#resourceTypeFilter_item4_SubList_item3 {
display: none;
}

#resourceTypeFilter_item4_SubList_item4 {
display: none;
}
#resourceTypeFilter_item4_SubList_item5 {
display: none;
}
#resourceTypeFilter_item4_SubList_item6 {
display: none;
}

</style>
</authz:authorize>
</authz:authorize>

Method 2:

Make data easy with Helical Insight.
Helical Insight is the world’s best open source business intelligence tool.

—————

You can directly hide the Items in the filters by just commenting the code in the specified 2 files given below..

1.applicationContext-Search.xml

2.applicationContext-Search-pro.xml

you will find both this files under the path..

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

To remove OLAP views and Data sources from the menu we have to make changes in applicationContext-Search.xml

Comment both the reference beans as shown below

<!– <ref bean=”${bean.resourceTypeFilter.option.view}”/> –>

<!– <ref bean=”${bean.resourceTypeFilter.option.dataSources}”/> –>

now their bean id…

——————————–

<!– <bean id=”resourceTypeFilter.view” class=”com.jaspersoft.jasperserver.search.common.Option”>

<property name=”id” value=”resourceTypeFilter-view”/>

<property name=”labelId” value=”SEARCH_TYPE_VIEW”/>

<property name=”roleAccessList” ref=”${bean.resourceTypeFilter.View.RoleAccessList}”/>

</bean>–>

<!– <bean id=”resourceTypeFilter.dataSources” class=”com.jaspersoft.jasperserver.search.common.Option”>

<property name=”id” value=”resourceTypeFilter-dataSources”/>

<property name=”labelId” value=”SEARCH_TYPE_DATASOURCES”/>

<property name=”roleAccessList” ref=”${bean.resourceTypeFilter.DataSources.RoleAccessList}”/>

</bean>–>

and finally entry key…

<!–<entry key=”resourceTypeFilter-view”>

<list>

<value>com.jaspersoft.jasperserver.api.metadata.olap.domain.OlapUnit</value>

</list>

</entry> –>

<!–<entry key=”resourceTypeFilter-dataSources”>

<list>

<value>com.jaspersoft.jasperserver.api.metadata.common.domain.DataSource</value>

<value>com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.ReportDataSource</value>

<value>com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.BeanReportDataSource</value>

<value>com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.CustomReportDataSource</value>

<value>com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.JdbcReportDataSource</value>

<value>com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.JndiJdbcReportDataSource</value>

<value>com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.VirtualReportDataSource</value>

<value>com.jaspersoft.jasperserver.api.metadata.olap.domain.MondrianConnection</value>

<value>com.jaspersoft.jasperserver.api.metadata.olap.domain.JndiJdbcOlapDataSource</value>

<value>com.jaspersoft.jasperserver.api.metadata.olap.domain.JdbcOlapDataSource</value>

<value>com.jaspersoft.jasperserver.api.metadata.olap.domain.OlapDataSource</value>

<value>com.jaspersoft.jasperserver.api.metadata.olap.domain.XMLAConnection</value>

<value>com.jaspersoft.jasperserver.api.metadata.olap.domain.XMLAConnection</value>

<value>com.jaspersoft.ji.adhoc.AdhocDataView</value>

</list>

</entry> –>

Similarly to comment the remaining domains and Adhoc views we have to make modifications in

applicationContext-Search-pro.xml

<!– <entry key=”resourceTypeFilter-adhocView”>

<list>

<value>com.jaspersoft.ji.adhoc.AdhocDataView</value>

</list>

</entry>

<entry key=”resourceTypeFilter-dataSources”>

<list>

<value>com.jaspersoft.jasperserver.api.metadata.common.domain.DataSource</value>

<value>com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.ReportDataSource</value>

<value>com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.BeanReportDataSource</value>

<value>com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.CustomReportDataSource</value>

<value>com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.JdbcReportDataSource</value>

<value>com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.JndiJdbcReportDataSource</value>

<value>com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.VirtualReportDataSource</value>

<value>com.jaspersoft.jasperserver.api.metadata.olap.domain.MondrianConnection</value>

<value>com.jaspersoft.jasperserver.api.metadata.olap.domain.JndiJdbcOlapDataSource</value>

<value>com.jaspersoft.jasperserver.api.metadata.olap.domain.JdbcOlapDataSource</value>

<value>com.jaspersoft.jasperserver.api.metadata.olap.domain.OlapDataSource</value>

<value>com.jaspersoft.jasperserver.api.metadata.olap.domain.XMLAConnection</value>

<value>com.jaspersoft.jasperserver.api.metadata.olap.domain.MondrianConnection</value>

<value>com.jaspersoft.ji.ja.security.domain.SecureMondrianConnection</value>

</list>

</entry>–>

<!–<entry key=”resourceTypeFilter-domains”>

<list>

<value>com.jaspersoft.commons.semantic.datasource.SemanticLayerDataSource</value>

</list>

</entry>–>

<!–<entry key=”resourceTypeFilter-adhocReports”>

<list>

<value>com.jaspersoft.ji.adhoc.AdhocReportUnit</value>

</list>

</entry>–>

Now bean classes and ref beans….

Make data easy with Helical Insight.
Helical Insight is the world’s best open source business intelligence tool.

<!–<bean class=”com.jaspersoft.jasperserver.search.common.Option”>

<property name=”id” value=”resourceTypeFilter-adhocView”/>

<property name=”labelId” value=”SEARCH_TYPE_ADHOC_VIEWS”/>

<property name=”roleAccessList” ref=”${bean.resourceTypeFilter.AdhocView.RoleAccessList}”/>

</bean>–>

<!– <ref bean=”${bean.resourceTypeFilter.option.view}”/> –>

<!– <bean class=”com.jaspersoft.jasperserver.search.common.Option”>

<property name=”id” value=”resourceTypeFilter-domains”/>

<property name=”labelId” value=”SEARCH_TYPE_DOMAINS”/>

<property name=”roleAccessList” ref=”${bean.resourceTypeFilter.Domains.RoleAccessList}”/>

</bean>–>

<!– <ref bean=”${bean.resourceTypeFilter.option.dataSources}”/>–>

<!– <bean class=”com.jaspersoft.jasperserver.search.common.Option”>

<property name=”id” value=”resourceTypeFilter-adhocReports”/>

<property name=”labelId” value=”SEARCH_TYPE_ADHOC_REPORTS”/>

<property name=”roleAccessList” ref=”${bean.resourceTypeFilter.Domains.RoleAccessList}”/>

</bean>–>

By making these changes you can able to see the result.

Note : If you want to use method 1 do not use method 2 that resembles the same result & in method 2 we haven’t provided role based security.

Thanks & regards,

A.prasanth kumar.

logo

Best Open Source Business Intelligence Software Helical Insight is Here

logo

A Business Intelligence Framework

0 0 votes
Article Rating
Subscribe
Notify of
4 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Nice work.

Can we use the same method to hide someone else schedules based on roles?

I would like to make schedules visible base on roles like GROUP1_USERS can only see schedules from GROUP1_USERS

Hi Andre,
Yes, we can hide schedule based on roles. For that we have to apply some changes in actionModel-Search.xml and replace your user role GROUP1_USERS in plce of ROLE_ADMINISTRATOR as shown below and restart your jasperserver in services.msc to Apply the changes

Hope this help you..

Thanks & Regards,
A.Prasanth Kumar

hi, is there any solution to hide menu items like home icon,repository in jasper server page?