Changing landing page by role

I want to change the landing page of the built-in ROLE_USER to listreports.html (the list of completed reports).

I edited WEB-INF/jasperserver-servlet.xml. It has a loginController bean with properties "homePageByRole" and "defaultHomePage". I changed it to look like the following:

Code:
        <br />
<property name="homePageByRole"><br />
  <list><br />
    <value>ROLE_ADMINISTRATOR|redirect:/flow.html?_flowId=repoAdminFlow</value><br />
    <value>ROLE_USER|redirect:/listreports.html</value><br />
  </list><br />
</property><br />
<property name="defaultHomePage"><br />
  <value>redirect:/home.html</value><br />
</property><br />
</td></tr></tbody></table><br />
<br />
I also changed applicationContext-security.xml to give ROLE_USER access to listreports.html.<br />
<br />
Trouble is, my users that have only the ROLE_USER role are still landing on flow.html?_flowId=repositoryFlow.  Even if I change the defaultHomePage property to listreports.html, they land on the same wrong page.<br />
<br />
I also tried using flow.html?_flowId=listReportsFlow, instead of listreports.html, but I got the same results.<br />
<br />
Do you see a step I'm missing here? <br />
<br />
Thanks!
sarahmei's picture
321
Joined: Jul 20 2006 - 2:32pm
Last seen: 17 years 2 months ago

11 Answers:

There is, indeed, something strange with this. Have you managed to get it working?

I've also tried it and it didn't work at the first login, but it worked from the second login onwards.

Regards,
Lucian
lucianc's picture
87121
Joined: Jul 17 2006 - 1:10am
Last seen: 16 hours 24 min ago
Hi,
I am also facing same problem when I tried to Change the home page to home.jsp.
I have changed in jasperserver-servlet.xml as follows

<property name="homePageByRole">
<list> <value>ROLE_ADMINISTRATOR|home</value>
<value>ROLE_USER|home</value>
</list>
</property>
<property name="defaultHomePage">
<value>redirect:/home.html</value>
</property>

But first time it goes to /flow.html?_flowId=repositoryFlow default.

after from second login it works perfectly from the same browser session.
Any solution to resolve this problem.


Thanks.

Note:
If I give "redirect:/home.html" its not working. Have to specify simply "home", it works from second time.
karthikcnetric's picture
Joined: Aug 28 2007 - 5:03pm
Last seen: 16 years 1 month ago
The user is presented flow.html?_flowId=repositoryFlow on the first login because of index.htm which redirects to this location. Change index.htm to redirect to home.html to fix the issue.

home.html is mapped to a controller that redirects or forwards the requests to the configured home page for the user/role. Hence using home.html as role home page results in an infite loop of redirections. Using "home" results in forwarding the request to home.jsp, which is the desired behaviour.

HTH,
Lucian
lucianc's picture
87121
Joined: Jul 17 2006 - 1:10am
Last seen: 16 hours 24 min ago
I changed the configurations as you told.
I now have the following configurations:

jasperserver-servlet.xml
Code:
<property name="homePageByRole"><br />
            <list><br />
                <value>ROLE_ADMINISTRATOR|redirect:/flow.html?_flowId=repoAdminFlow</value><br />
                <value>ROLE_USER|redirect:/flow.html?_flowId=listReportsFlow</value><br />
            </list><br />
        </property><br />
        <property name="defaultHomePage"><br />
        	<value>redirect:/home.html</value><br />
      	</property></td></tr></tbody></table><br />
<br />
<b>index.html</b><br />
<br />
<table align="center" border="0" cellpadding="3" cellspacing="1" width="90%"><tbody><tr><td><b>Code:</b></td></tr><tr><td><pre><title></title><br />
    <meta http-equiv="refresh" content="0;url=home.html"><br />
     <script language="javascript" type="text/javascript"><br />
     window.location="flow.html?_flowId=repositoryFlow";<br />
     </script><br />
<br />
  </head><br />
  <body><br />
  If your browser doesn't automatically go there,<br />
you may want to go to <a href="home.html">the destination</a><br />
manually.<br />
<br />
  </body></td></tr></tbody></table><br />
<br />
But i am still getting the redirection to repository.<br />
Am i doing something wrong?
umair's picture
515
Joined: Mar 10 2008 - 12:04am
Last seen: 15 years 6 months ago
Could you try to change
Code:
<br />
window.location="flow.html?_flowId=repositoryFlow";<br />
</td></tr></tbody></table><br />
to<br />
<table align="center" border="0" cellpadding="3" cellspacing="1" width="90%"><tbody><tr><td><b>Code:</b></td></tr><tr><td><pre><br />
window.location="home.html";<br />
</td></tr></tbody></table><br />
in index.html, and clear your browser's cache?<br />
<br />
Regards,<br />
Lucian
lucianc's picture
87121
Joined: Jul 17 2006 - 1:10am
Last seen: 16 hours 24 min ago
I appreciate your help :)
Works like a charm
umair's picture
515
Joined: Mar 10 2008 - 12:04am
Last seen: 15 years 6 months ago
Is this valid solution also for JS3 ?:unsure:

I have some problem to locate "window.location"
as specified above.

Regards.

Borut
report_slo's picture
Joined: Apr 29 2008 - 3:47pm
Last seen: 15 years 5 months ago
The file is $TOMCAT/webapps/jasperserver/index.htm.

JS 3.0 uses
Code:
<br />
window.location="flow.html?_flowId=repositoryExplorerFlow";<br />
</td></tr></tbody></table><br />
<br />
Regards,<br />
Lucian
lucianc's picture
87121
Joined: Jul 17 2006 - 1:10am
Last seen: 16 hours 24 min ago
Thank you for quick replay :)

It works nice.B)

Regards.

Borut
report_slo's picture
Joined: Apr 29 2008 - 3:47pm
Last seen: 15 years 5 months ago

lucianc
Wrote:
 

Could you try to change
Code:
<br />
window.location="flow.html?_flowId=repositoryFlow";<br />

to
Code:
<br />
window.location="home.html";<br />

in index.html, and clear your browser's cache?

Regards,
Lucian

HI ,

I am doing the same thing but getting AccessDeniedException Any suggestion on this Lucian.

Vishal

vishal29bhp's picture
Joined: Mar 6 2009 - 3:23am
Last seen: 14 years 6 months ago

vishal29bhp
Wrote:

HI ,

I am doing the same thing but  getting AccessDeniedException Any suggestion on this Lucian.

Vishal

In which scenario does this happen?  Is a user logged in?

Regards,

Lucian

lucianc's picture
87121
Joined: Jul 17 2006 - 1:10am
Last seen: 16 hours 24 min ago
Feedback