Addons

HOWTO: Customize Startup Redirection

Updated: March 18, 2024

After connection, the startup page is defined by the method StartupHelper.initDomainAndFindStartupPage. If you want to customize the startup redirection, you have to override the method initDomainAndFindStartupPage in a custom class.

The following example presents a customization redirecting every user to the dashboard except for the Administrators:

@Name("startupHelper")
@Scope(SESSION)
@Install(precedence=DEPLOYMENT)
public class CustomStartupHelper extends StartupHelper {

    private static final long serialVersionUID = 1L;

    @Override
    @Begin(id = "#{conversationIdGenerator.nextMainConversationId}", join = true)
    public String initDomainAndFindStartupPage(String domainTitle, String viewId) {
        String result = super.initDomainAndFindStartupPage(domainTitle, viewId);
        if (((NuxeoPrincipal) documentManager.getPrincipal()).isAdministrator()) {
            return result;
        } else {
            return dashboardNavigationHelper.navigateToDashboard();
        }
    }
}

The method initDomainAndFindStartupPage must return an existing view id. For example, the following view id can be used to customize the redirection:

  • view_servers to access the list of available servers
  • view_home to access the dashboard of the current user
  • view_domains to access the list of domains
  • search to access the search page