Used Jasper Report Server Version : 6.4.2
Process :
- Goto path \webapps\jasperserver-pro\WEB-INF
- Open the applicationContext-rest-services.xml file.
Here, we can modify home-page content as per our requirement. For example, I’ll show you how to hide tutorials from role-based users. Here I’m taking an external role as “TENANT ADMINISTRATOR” and belongs to the organization 1 and applying the restrictions to it.
STEP 1: In the above XML file first we need to declare the variables of tutorials which we are going to hide, like ‘SEE_DOMAINS_ALLOWED’,’SEE_DATASOURCE_ALLOWED’ etc. inside the “securityMetadataSource” method. Shown below.
<property name="securityMetadataSource"> <security:method-security-metadata-source> <security:protect method="com.jaspersoft.jasperserver.jaxrs.poc.hypermedia.workflow.data.UserWorkflowStorage.findByName" access="ADMINISTRATION_ALLOWED,CONFIGURATION_ALLOWED,SEE_DOMAINS_ALLOWED,SEE_DATASOURCE_ALLOWED,SEE_ADHOCS_ALLOWED,SEE_REPORTS_ALLOWED,SEE_DASHBOARDS_ALLOWED"/> <security:protect method="com.jaspersoft.jasperserver.jaxrs.poc.hypermedia.workflow.data.UserWorkflowStorage.findAllByParentName" access="ADMINISTRATION_ALLOWED,CONFIGURATION_ALLOWED,SEE_DOMAINS_ALLOWED,SEE_DATASOURCE_ALLOWED,SEE_ADHOCS_ALLOWED,SEE_REPORTS_ALLOWED,SEE_DASHBOARDS_ALLOWED"/> </security:method-security-metadata-source> </property>
STEP 2: Define the above-declared sources and give restrictions as per the role authenticated users exactly below of the above code. I have shown the code below to display only ‘adhoc_views’ tutorials for the ‘Tenant_Administrator’.
<bean class="com.jaspersoft.jasperserver.jaxrs.poc.hypermedia.workflow.service.WorkflowsSecurityFilter"> <property name="supportedAttribute" value="SEE_ADHOCS_ALLOWED"/> <property name="allowedRoles"> <util:list> <value>TENANT_ADMINISTRATOR|1</value> </util:list> </property> <property name="workflowsToSecure"> <list> <value>adhocView</value> </list> </property> </bean>
We can apply the conditions to ‘report’,’dashboard’,’dataSource’,’domain’ tutorials according to the role-based users in the above-mentioned way.
Pictorial View :
Pic 1: The user whose role assigned as ‘TENANT_ADMINISTRATOR’
Pic 2: Before hiding the tutorials for the user.
Pic 3: After the logic applied on the particular user.
I hope it helps.
In case if you have any queries please get us support@helicaltech.com
Best Open Source Business Intelligence Software Helical Insight is Here
A Business Intelligence Framework
Thanks,
Prashanth Kasoji
BI Developer
Helical IT Solutions Pvt Ltd