diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/IndexController.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/IndexController.java
new file mode 100644
index 000000000..33e48c783
--- /dev/null
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/IndexController.java
@@ -0,0 +1,61 @@
+/*
+ * This file is part of LibrePlan
+ *
+ * Copyright (C) 2012 Igalia, S.L.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package org.libreplan.web.common;
+
+import org.libreplan.business.users.entities.UserRole;
+import org.libreplan.web.security.SecurityUtils;
+import org.libreplan.web.users.services.CustomTargetUrlResolver;
+import org.zkoss.zk.ui.Component;
+import org.zkoss.zk.ui.Executions;
+import org.zkoss.zk.ui.util.GenericForwardComposer;
+
+/**
+ * Controller to redirect user to proper initial page depending or roles.
+ *
+ * @author Manuel Rego Casasnovas
+ */
+@SuppressWarnings("serial")
+public class IndexController extends GenericForwardComposer {
+
+ @Override
+ public void doAfterCompose(Component comp) throws Exception {
+ super.doAfterCompose(comp);
+
+ String url = getInitialPageURL();
+ Executions.sendRedirect(url);
+ }
+
+ private String getInitialPageURL() {
+ if (SecurityUtils.isUserInRole(UserRole.ROLE_SUPERUSER)) {
+ return CustomTargetUrlResolver.PLANNING_URL;
+ }
+
+ if (SecurityUtils.isUserInRole(UserRole.ROLE_BOUND_USER)) {
+ return CustomTargetUrlResolver.USER_DASHBOARD_URL;
+ }
+
+ if (SecurityUtils.isSuperuserOrRolePlanningOrHasAnyAuthorization()) {
+ return CustomTargetUrlResolver.PLANNING_URL;
+ }
+
+ return CustomTargetUrlResolver.SETTINGS_URL;
+ }
+
+}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/users/services/CustomTargetUrlResolver.java b/libreplan-webapp/src/main/java/org/libreplan/web/users/services/CustomTargetUrlResolver.java
index 01d643266..a70659c9d 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/users/services/CustomTargetUrlResolver.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/users/services/CustomTargetUrlResolver.java
@@ -47,9 +47,9 @@ public class CustomTargetUrlResolver extends TargetUrlResolverImpl {
public final static String USER_DASHBOARD_URL = "/myaccount/userDashboard.zul";
- private static final String PLANNING_URL = "/planner/index.zul";
+ public static final String PLANNING_URL = "/planner/index.zul";
- private static final String SETTINGS_URL = "/myaccount/settings.zul";
+ public static final String SETTINGS_URL = "/myaccount/settings.zul";
@Autowired
private IUserDAO userDAO;
diff --git a/libreplan-webapp/src/main/webapp/WEB-INF/web.xml b/libreplan-webapp/src/main/webapp/WEB-INF/web.xml
index 05cffc836..fc32d04c2 100644
--- a/libreplan-webapp/src/main/webapp/WEB-INF/web.xml
+++ b/libreplan-webapp/src/main/webapp/WEB-INF/web.xml
@@ -139,7 +139,7 @@
- /planner/index.zul
+ /index.zul
diff --git a/libreplan-webapp/src/main/webapp/index.zul b/libreplan-webapp/src/main/webapp/index.zul
new file mode 100644
index 000000000..918ef1471
--- /dev/null
+++ b/libreplan-webapp/src/main/webapp/index.zul
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+