Jump to content
Changes to the Jaspersoft community edition download ×

Changing landing page by role


sarahmei

Recommended Posts

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:
        
<property name="homePageByRole">
<list>
<value>ROLE_ADMINISTRATOR|redirect:/flow.html?_flowId=repoAdminFlow</value>
<value>ROLE_USER|redirect:/listreports.html</value>
</list>
</property>
<property name="defaultHomePage">
<value>redirect:/home.html</value>
</property>

 

I also changed applicationContext-security.xml to give ROLE_USER access to listreports.html.

 

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.

 

I also tried using flow.html?_flowId=listReportsFlow, instead of listreports.html, but I got the same results.

 

Do you see a step I'm missing here?

 

Thanks!

Link to comment
Share on other sites

  • Replies 11
  • Created
  • Last Reply

Top Posters In This Topic

  • 1 year later...

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 6 months later...

I changed the configurations as you told.

I now have the following configurations:

 

jasperserver-servlet.xml

Code:
<property name="homePageByRole">
<list>
<value>ROLE_ADMINISTRATOR|redirect:/flow.html?_flowId=repoAdminFlow</value>
<value>ROLE_USER|redirect:/flow.html?_flowId=listReportsFlow</value>
</list>
</property>
<property name="defaultHomePage">
<value>redirect:/home.html</value>
</property>

 

index.html

 

Code:
[code]<title></title>
<meta http-equiv="refresh" content="0;url=home.html">
<script language="javascript" type="text/javascript">
window.location="flow.html?_flowId=repositoryFlow";
</script>

</head>
<body>
If your browser doesn't automatically go there,
you may want to go to <a href="home.html">the destination</a>
manually.

</body>

 

But i am still getting the redirection to repository.

Am i doing something wrong?

Link to comment
Share on other sites

  • 11 months later...
  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...