Exemple #1
0
  public static Class<? extends Page> getHomepageForRole(Roles roles) {
    Class<? extends Page> homepage;

    if (roles.contains(WebUtils.ROLE_CONSULTANT)) {
      homepage = MonthOverviewPage.class;
    } else if (roles.contains(WebUtils.ROLE_ADMIN)) {
      homepage = MainConfigPage.class;
    } else if (roles.contains(WebUtils.ROLE_REPORT)) {
      homepage = ReportPage.class;
    } else {
      homepage = MonthOverviewPage.class;
    }

    return homepage;
  }
Exemple #2
0
  /**
   * Check if the logged in user has the specified role
   *
   * @param role
   * @return
   */
  public static boolean hasRole(String role) {
    Roles roles = getRoles();

    return (roles != null) && roles.contains(role);
  }