NOTE: This blog is relevant to version 3.0, 3.1, 4.0 and 4.1 of Helical Insight and will not work for any other version. You can know the version from the bottom left (above file browser) or from the admin page.
By default there is a page which appears when a user login as administrator or other users.
In this document, we are going to cover what all changes are required to modify default landing page or welcome page which occurs when user logs in.
-
- Open welcome.jsp using suitable editor which is present at following location given below:
Location:: \hi\apache-tomcat-7\webapps\hi-ee\WEB-INF\jsp\login
-
- Search for the code given below:
<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> <c:if test="${param.file eq null}"> <jsp:forward page="/admin/home.html"/> </c:if> </auth:authorize> <auth:authorize access="isAuthenticated()"> <jsp:forward page="/hi.html"/> </auth:authorize> </div>
-
- In the above code we are checking if the role is Admin or not. If it is admin then it will load default page hi.html.
You can make changes here and whatever HTML/dashboard/report path name you give will become the landing page.
-
- In below code I have passed URL of one of my report.
<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>
<c:if test=”${param.file eq null}”>
<jsp:forward page=”/hi.html?dir=1463377807724/1465647380854&file=3a91fae9-6d4d-48fc-a718-83f38613198f.efw”/>
</c:if>
</auth:authorize>
<auth:authorize access=”isAuthenticated()”>
<jsp:forward page=”/hi.html”/>
</auth:authorize>
</div>
- Save the file and refresh application.
In the above, we are checking based on role. Rather than that we also have organization wise or user wise or profile wise also. This code also supports if else statements or case statements also.
For example, for organization
<c:set var ="orgName" value="${sessionScope.SPRING_SECURITY_CONTEXT.authentication.principal.org_name}" /> <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> <c:if test="${param.file eq null}"> <c:if test="${orgName eq 'swcustomer5'}"> <jsp:forward page="/hi.html?dir=1530683936494/1538745485381&file=2b159a8e-98dd-4bb6-8ab1-6091b35c4d0d.efw"/> </c:if> <c:if test="${orgName eq 'fedex'}"> <jsp:forward page="/hi.html?dir=1530683936494/1538745485381&file=2b159a8e-98dd-4bb6-8ab1-6091b35c4d0d.efw"/> </c:if> <jsp:forward page="/hi.html?dir=1530683936494&file=a93f1654-6394-4351-b9fb-0a3552af91f3.efw"/> </c:if> </auth:authorize> <auth:authorize access="isAuthenticated()"> <c:if test="${orgName eq 'swcustomer5'}"> <jsp:forward page="/hi.html?dir=1530683936494/1538745485381&file=2b159a8e-98dd-4bb6-8ab1-6091b35c4d0d.efw"/> </c:if> <c:if test="${orgName eq 'fedex'}"> <jsp:forward page="/hi.html?dir=1530683936494/1538745485381&file=2b159a8e-98dd-4bb6-8ab1-6091b35c4d0d.efw"/> </c:if> <jsp:forward page="/hi.html?dir=1530683936494&file=a93f1654-6394-4351-b9fb-0a3552af91f3.efw"/> </auth:authorize>