Is it possible to have role based landing dashboard customization?

Hi Team,

In my organization there are different roles like admin, user, executive. As soon as they login I would like that they should have a landing dashboard which is customized and different for that specific role. How can something like that can be done?

Thank You

1 Like

Hi Anu,
Yes, that is possible.
Save the below mentioned code as welcome.jsp and save it in the location “C:\Program Files\Helical Insight\hi\apache-tomcat-7\webapps\hi-ee\WEB-INF\jsp\login”. The path might be different if you are on a different OS. In the below code you can see there are different roles defined like Director, Marketing, Admin etc. Below that, in the “file” and “dir” the actual physical name of the dashboard/report file and its path is mentioned. You can change that and extend that as per your requirement.

<%@ page import="com.helicalinsight.efw.framework.utils.ApplicationContextAccessor" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.springframework.org/security/tags"
prefix="sec" %>
<%@ taglib prefix="auth" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<auth:authentication property="authorities" var="authorities"/>
<c:if test="${fn:length(authorities) eq 0}">
<jsp:include page="/WEB-INF/jsp/errorPages/accessdenied.jsp"/>
</c:if>

<c:if test="${fn:length(authorities) ne 0}">
<c:if test="${empty applicationSettings}">
<c:set var="applicationSettings" value='<%=ApplicationContextAccessor.getBean("applicationSettings")%>'
scope="session"/>
</c:if>
<div>
<auth:authorize access="hasRole('ROLE_ADMIN')">
<c:if test="${param.file ne null and param.dir ne null}">
<jsp:forward page="/hi.html"/>
</c:if>
</auth:authorize>
<c:if test="${param.file eq null}">
<auth:authorize access="hasRole('DIRECTOR')">
<jsp:forward
page="/hi.html">
<jsp:param name="dir" value="1556101091507/1556101136715"/>
<jsp:param name="file" value="dca0f83a-2d34-4873-9138-5d10afcde858.efw"/>
<jsp:param name="mode" value="open"/>
</jsp:forward>
</auth:authorize>

<auth:authorize access="hasRole('MARKETING')">
<jsp:forward
page="/hi.html">
<jsp:param name="dir" value="1549286391496/1551955056693"/>
<jsp:param name="file" value="0bb7eb14-1d2b-4cb2-b570-f1de8d3c3c7a.efw"/>
<jsp:param name="mode" value="open"/>
</jsp:forward>

</auth:authorize>


<auth:authorize access="hasRole('DB_HEAD')">
<jsp:forward
page="/hi.html">
<jsp:param name="dir" value="1556101091507/1557846768305"/>
<jsp:param name="file" value="1d050ab7-697d-4248-aff5-8f631c54493a.report"/>
<jsp:param name="mode" value="open"/>
</jsp:forward>


</auth:authorize>

<auth:authorize access="hasRole('ROLE_ADMIN')">
<jsp:forward page="/admin/home.html"/>
</auth:authorize>


</c:if>


<auth:authorize access="isAuthenticated()">
<jsp:forward page="/hi.html"/>
</auth:authorize>
</div>
</c:if>

Thank You
Helical Insight Team.