public final void setRoles(Roles requiredRoles, Roles basicRoles) {
   boolean changed = false;
   if (requiredRoles != null) {
     changed = true;
     m_requiredRoles = requiredRoles;
     setProperty(REQUIRED_ROLES, requiredRoles.toArray(ROLES_TYPE));
   }
   if (basicRoles != null) {
     m_basicRoles = basicRoles;
     setProperty(REQUIRED_ROLES, basicRoles.toArray(ROLES_TYPE));
     changed = true;
   }
   if (changed) {
     updateRegistration();
   }
 }
  /**
   * Construct.
   *
   * @param pId component id
   */
  PostLoginMenuPanel(final String pId) {
    super(pId);

    final Roles roles = ((Session) getSession()).getRoles();

    add(usernameLabel);
    add(passwordExpiryDateLabel);
    add(logoutLink);
    add(homePageLink);
    add(changePasswordLink);
    add(
        createUserLink.setVisible(
            roles.hasRole(com.github.wicketoracle.app.createuser.RequiredRoles.ROLE_CREATE_USER)));
    add(
        manageUCPLink.setVisible(
            roles.hasRole(com.github.wicketoracle.app.ucp.RequiredRoles.ROLE_UCP_MGR)));
    add(
        manageDelegateUsersLink.setVisible(
            roles.hasRole(
                com.github.wicketoracle.app.user.delegate.mgr.RequiredRoles
                    .ROLE_DELEGATE_APP_USER_MGR)));
    add(
        manageStandardUsersLink.setVisible(
            roles.hasRole(
                com.github.wicketoracle.app.user.standard.mgr.RequiredRoles
                    .ROLE_STANDARD_APP_USER_MGR)));
    add(
        manageDataLink.setVisible(
            roles.hasRole(com.github.wicketoracle.app.data.RequiredRoles.ROLE_REF_DATA_MGR)));
    add(
        reportsLink.setVisible(
            roles.hasRole(com.github.wicketoracle.app.report.RequiredRoles.ROLE_REPORT_USER)));
  }
  /**
   * Returns {@code true} if the user roles is approved to create this content source component,
   * {@code false} otherwise.
   *
   * @return A {@code boolean} indicator whether user roles is approved to create this content
   *     source component.
   * @since 1.0.0
   */
  private boolean isRolesAuthorized() {
    PaxWicketAuthentication paxWicketAuthentication = getAuthentication();
    Roles userRoles;
    if (paxWicketAuthentication != null) {
      userRoles = paxWicketAuthentication.getRoles();
    } else {
      userRoles = newRoles(null);
    }

    Roles requiredRoles = newRoles(getStringProperty(REQUIRED_ROLES, null));
    Roles basicRoles = newRoles(getStringProperty(BASIC_ROLES, null));

    boolean isRequiredRolesAuthorized = true;
    if (!requiredRoles.isEmpty()) {
      isRequiredRolesAuthorized = userRoles.hasAllRoles(requiredRoles);
    }

    boolean isBasicRolesAuthorized = true;
    if (!basicRoles.isEmpty()) {
      isBasicRolesAuthorized = userRoles.hasAnyRole(basicRoles);
    }

    return isRequiredRolesAuthorized && isBasicRolesAuthorized;
  }