public String doProcessAndFilter() throws Exception {
    String sortColNumber = getRequest().getParameter("iSortCol_0");
    String sortDirection = getRequest().getParameter("sSortDir_0");
    if (sortDirection == null || sortDirection.equals("")) sortDirection = "asc";

    if (sSearch == null || sSearch.equals(""))
      this.infogluePrincipals = UserControllerProxy.getController().getAllUsers();
    else
      this.infogluePrincipals = UserControllerProxy.getController().getFilteredUsers(this.sSearch);

    String sortProperty = "name";
    if (sortColNumber != null && sortColNumber.equals("2")) sortProperty = "firstName";
    else if (sortColNumber != null && sortColNumber.equals("3")) sortProperty = "lastName";

    Collections.sort(this.infogluePrincipals, new ReflectionComparator(sortProperty));
    if (sortDirection.equals("desc")) {
      Collections.reverse(this.infogluePrincipals);
    }

    this.iTotalRecords = this.infogluePrincipals.size();
    this.iTotalDisplayRecords = this.infogluePrincipals.size();

    String iDisplayStartString = getRequest().getParameter("iDisplayStart");
    String iDisplayLengthString = getRequest().getParameter("iDisplayLength");
    int start = new Integer(iDisplayStartString);
    int end = start + new Integer(iDisplayLengthString);

    if (this.infogluePrincipals.size() > end)
      this.infogluePrincipals = this.infogluePrincipals.subList(start, end);
    else
      this.infogluePrincipals =
          this.infogluePrincipals.subList(start, this.infogluePrincipals.size());

    return "successFiltered";
  }
  protected String doExecute() throws Exception {
    this.filterRoleNames = this.getRequest().getParameterValues("filterRoleName");
    if (filterFirstName == null
        && filterLastName == null
        && filterUserName == null
        && filterEmail == null
        && (filterRoleNames == null
            || filterRoleNames.length == 0
            || (filterRoleNames.length == 1 && filterRoleNames[0].equals("")))) {
      this.infogluePrincipals = UserControllerProxy.getController().getAllUsers();
      this.numberOfSlots = this.infogluePrincipals.size() / 100;
      int startIndex = 0 + (slotId * 100);
      int endIndex = 0 + (slotId * 100) + 100;
      if (endIndex > this.infogluePrincipals.size()) endIndex = this.infogluePrincipals.size();

      this.infogluePrincipals = this.infogluePrincipals.subList(startIndex, endIndex);
    } else {
      this.infogluePrincipals =
          UserControllerProxy.getController()
              .getFilteredUsers(
                  this.filterFirstName,
                  this.filterLastName,
                  this.filterUserName,
                  this.filterEmail,
                  filterRoleNames);
    }
    this.infogluePrincipals = this.infogluePrincipals.subList(0, 100);

    return "success";
  }
  /** Registers a new system user. */
  public Boolean createUser(
      final String principalName,
      String firstName,
      String lastName,
      String email,
      String userName,
      String password,
      List roleNames,
      List groupNames) {
    if (!ServerNodeController.getController().getIsIPAllowed(getRequest())) {
      logger.error(
          "A client with IP "
              + getRequest().getRemoteAddr()
              + " was denied access to the webservice. Could be a hack attempt or you have just not configured the allowed IP-addresses correct.");
      return new Boolean(false);
    }

    Boolean status = new Boolean(true);

    logger.info("***************************************");
    logger.info("Creating user through webservice.......");
    logger.info("***************************************");

    try {
      initializePrincipal(principalName);

      SystemUserVO systemUserVO = new SystemUserVO();
      systemUserVO.setFirstName(firstName);
      systemUserVO.setLastName(lastName);
      systemUserVO.setEmail(email);
      systemUserVO.setUserName(userName);
      systemUserVO.setPassword(password);

      Object[] roleNamesArray = roleNames.toArray();
      Object[] groupNamesArray = groupNames.toArray();

      String[] roles = new String[roleNamesArray.length];
      String[] groups = new String[groupNamesArray.length];

      for (int i = 0; i < roleNamesArray.length; i++) roles[i] = "" + roleNamesArray[i];

      for (int i = 0; i < groupNamesArray.length; i++) groups[i] = "" + groupNamesArray[i];

      userControllerProxy.createUser(systemUserVO);
      userControllerProxy.updateUser(systemUserVO, roles, groups);
    } catch (Exception e) {
      status = new Boolean(false);
      logger.error(
          "En error occurred when we tried to create a new contentVersion:" + e.getMessage(), e);
    }

    updateCaches();

    return status;
  }
  /**
   * This method initializes the view by populating all the entities. It fetches the role itself,
   * the type of authorization update support and all the assigned principals. It then populates a
   * list of unassigned principals.
   */
  protected void initialize(String roleName) throws Exception {
    this.infoGlueRole = RoleControllerProxy.getController().getRole(roleName);
    this.supportsUpdate = this.infoGlueRole.getAutorizationModule().getSupportUpdate();
    this.availableSystemUserCount =
        UserControllerProxy.getTableCount("cmSystemUser", "userName").getCount();
    if (this.supportsUpdate) {
      this.assignedInfoGluePrincipals =
          this.infoGlueRole.getAutorizationModule().getRoleUsers(roleName);
      if (availableSystemUserCount < 10000) {
        this.infoGluePrincipals = this.infoGlueRole.getAutorizationModule().getUsers();
        // this.supportsUpdate				= RoleControllerProxy.getController().getSupportUpdate();
        if (this.supportsUpdate) // Only fetch if the user can edit.
        {
          List newInfogluePrincipals = new ArrayList();
          newInfogluePrincipals.addAll(this.infoGluePrincipals);
          newInfogluePrincipals.removeAll(assignedInfoGluePrincipals);
          this.unassignedInfoGluePrincipals = newInfogluePrincipals;
        }
      }
    }

    this.contentTypeDefinitionVOList =
        ContentTypeDefinitionController.getController()
            .getContentTypeDefinitionVOList(ContentTypeDefinitionVO.EXTRANET_ROLE_PROPERTIES);
    this.assignedContentTypeDefinitionVOList =
        RolePropertiesController.getController().getContentTypeDefinitionVOList(roleName);
  }
  /** Deletes a system user. */
  public Boolean deleteUser(final String principalName, String userName) {
    if (!ServerNodeController.getController().getIsIPAllowed(getRequest())) {
      logger.error(
          "A client with IP "
              + getRequest().getRemoteAddr()
              + " was denied access to the webservice. Could be a hack attempt or you have just not configured the allowed IP-addresses correct.");
      return new Boolean(false);
    }

    Boolean status = new Boolean(true);

    logger.info("***************************************");
    logger.info("Delete user through webservice.........");
    logger.info("***************************************");

    try {
      initializePrincipal(principalName);

      userControllerProxy.deleteUser(userName);
    } catch (Exception e) {
      status = new Boolean(false);
      logger.error(
          "En error occurred when we tried to create a new contentVersion:" + e.getMessage(), e);
    }

    updateCaches();

    return status;
  }
  protected void initialize(String userName) throws Exception {
    // this.supportsUpdate					= UserControllerProxy.getController().getSupportUpdate();
    this.infoGluePrincipal = UserControllerProxy.getController().getUser(userName);

    if (infoGluePrincipal == null)
      throw new SystemException(
          "No user found called '"
              + userName
              + "'. This could be an encoding issue if you gave your user a login name with non ascii chars in it. Look in the administrative manual on how to solve it.");

    this.supportsUpdate = this.infoGluePrincipal.getAutorizationModule().getSupportUpdate();

    this.assignedRoleVOList = infoGluePrincipal.getRoles();
    if (this.supportsUpdate) // Only fetch if the user can edit.
    this.roles = this.infoGluePrincipal.getAutorizationModule().getRoles();

    this.assignedGroupVOList = infoGluePrincipal.getGroups();
    if (this.supportsUpdate) // Only fetch if the user can edit.
    this.groups = this.infoGluePrincipal.getAutorizationModule().getGroups();

    this.contentTypeDefinitionVOList =
        ContentTypeDefinitionController.getController()
            .getContentTypeDefinitionVOList(ContentTypeDefinitionVO.EXTRANET_USER_PROPERTIES);
    this.assignedContentTypeDefinitionVOList =
        UserPropertiesController.getController().getContentTypeDefinitionVOList(userName);
  }
  public String doInputV3() throws Exception {
    this.infoGluePrincipals = UserControllerProxy.getController().getAllUsers();
    this.contentTypeDefinitionVOList =
        ContentTypeDefinitionController.getController()
            .getContentTypeDefinitionVOList(ContentTypeDefinitionVO.EXTRANET_ROLE_PROPERTIES);

    return "inputV3";
  }
 /**
  * Checks if the principal exists and if the principal is allowed to create the workflow.
  *
  * @param userName the name of the user.
  * @param workflowName the name of the workflow to create.
  * @throws SystemException if the principal doesn't exists or doesn't have permission to create
  *     the workflow.
  */
 private void initializePrincipal(final String userName) throws SystemException {
   try {
     principal = UserControllerProxy.getController().getUser(userName);
   } catch (SystemException e) {
     throw e;
   } catch (Exception e) {
     throw new SystemException(e);
   }
   if (principal == null) {
     throw new SystemException("No such principal [" + userName + "].");
   }
 }
  public Principal loginUser(HttpServletRequest request, HttpServletResponse response, Map status)
      throws SystemException, Exception {
    Principal principal = null;

    String authenticatedUserName = getAuthenticatedUserName(request, response, status);
    if (authenticatedUserName != null) {
      principal = UserControllerProxy.getController().getUser(authenticatedUserName);
      if (principal == null)
        throw new SystemException(
            "The CAS-authenticated user "
                + authenticatedUserName
                + " was not located in the authorization system's user database.");
    }

    return principal;
  }
  public String doV3() throws Exception {
    try {
      doExecute();

      String[] interceptionPointNames =
          new String[] {"Role.ManageUsers", "Role.ManageAccessRights", "Role.ReadForAssignment"};
      AccessRightController.getController()
          .addUserRights(interceptionPointNames, getRoleName(), getInfoGluePrincipal());
    } catch (ConstraintException e) {
      this.infoGluePrincipals = UserControllerProxy.getController().getAllUsers();
      this.contentTypeDefinitionVOList =
          ContentTypeDefinitionController.getController()
              .getContentTypeDefinitionVOList(ContentTypeDefinitionVO.EXTRANET_ROLE_PROPERTIES);

      e.setResult(INPUT + "V3");
      throw e;
    }

    return "successV3";
  }
  public Object authenticate(String user, String pwd) {
    if (logger.isInfoEnabled()) logger.info("authenticate user:"******"j_username", user);
      loginMap.put("j_password", pwd);
      String authenticatedUserName =
          AuthenticationModule.getAuthenticationModule(null, null).authenticateUser(loginMap);
      if (logger.isInfoEnabled()) logger.info("authenticatedUserName:" + authenticatedUserName);

      if (authenticatedUserName != null)
        this.principal = UserControllerProxy.getController().getUser(authenticatedUserName);

      return authenticatedUserName;
    } catch (Exception e) {
      e.printStackTrace();
    }

    return null;
  }
  public String doUserListSearch() throws Exception {
    String searchString = this.getRequest().getParameter("searchString");
    List<InfoGluePrincipal> searchResult =
        UserControllerProxy.getController().getFilteredUsers(searchString, null, null, null, null);
    ServletOutputStream myOut = getResponse().getOutputStream();

    myOut.print(
        "<select name=\"searchResult\" size=\"10\" class=\"userSelectBox\" multiple=\"true\">");

    for (InfoGluePrincipal igp : searchResult) {
      myOut.print(
          "<option value=\""
              + igp.getName()
              + "\">"
              + igp.getFirstName()
              + " "
              + igp.getLastName()
              + "</option>");
    }

    myOut.print("</select>");

    return "none";
  }
/**
 * This class is responsible for letting an external application call InfoGlue API:s remotely. It
 * handles api:s to manage user properties.
 *
 * @author Mattias Bogeblad
 */
public class RemoteUserServiceImpl extends RemoteInfoGlueService {
  private static final Logger logger = Logger.getLogger(RemoteUserServiceImpl.class.getName());

  /** The principal executing the workflow. */
  private InfoGluePrincipal principal;

  private static UserControllerProxy userControllerProxy = UserControllerProxy.getController();

  /** Registers a new system user. */
  public Boolean createUser(
      final String principalName,
      String firstName,
      String lastName,
      String email,
      String userName,
      String password,
      List roleNames,
      List groupNames) {
    if (!ServerNodeController.getController().getIsIPAllowed(getRequest())) {
      logger.error(
          "A client with IP "
              + getRequest().getRemoteAddr()
              + " was denied access to the webservice. Could be a hack attempt or you have just not configured the allowed IP-addresses correct.");
      return new Boolean(false);
    }

    Boolean status = new Boolean(true);

    logger.info("***************************************");
    logger.info("Creating user through webservice.......");
    logger.info("***************************************");

    try {
      initializePrincipal(principalName);

      SystemUserVO systemUserVO = new SystemUserVO();
      systemUserVO.setFirstName(firstName);
      systemUserVO.setLastName(lastName);
      systemUserVO.setEmail(email);
      systemUserVO.setUserName(userName);
      systemUserVO.setPassword(password);

      Object[] roleNamesArray = roleNames.toArray();
      Object[] groupNamesArray = groupNames.toArray();

      String[] roles = new String[roleNamesArray.length];
      String[] groups = new String[groupNamesArray.length];

      for (int i = 0; i < roleNamesArray.length; i++) roles[i] = "" + roleNamesArray[i];

      for (int i = 0; i < groupNamesArray.length; i++) groups[i] = "" + groupNamesArray[i];

      userControllerProxy.createUser(systemUserVO);
      userControllerProxy.updateUser(systemUserVO, roles, groups);
    } catch (Exception e) {
      status = new Boolean(false);
      logger.error(
          "En error occurred when we tried to create a new contentVersion:" + e.getMessage(), e);
    }

    updateCaches();

    return status;
  }

  /** Updates a system user. */
  public Boolean updateUser(
      final String principalName,
      String firstName,
      String lastName,
      String userName,
      String password,
      String email,
      String[] roleNames,
      String[] groupNames) {
    if (!ServerNodeController.getController().getIsIPAllowed(getRequest())) {
      logger.error(
          "A client with IP "
              + getRequest().getRemoteAddr()
              + " was denied access to the webservice. Could be a hack attempt or you have just not configured the allowed IP-addresses correct.");
      return new Boolean(false);
    }

    Boolean status = new Boolean(true);

    logger.info("***************************************");
    logger.info("Updating user through webservice.......");
    logger.info("***************************************");

    try {
      initializePrincipal(principalName);

      SystemUserVO systemUserVO = new SystemUserVO();
      systemUserVO.setUserName(userName);
      systemUserVO.setEmail(email);
      systemUserVO.setFirstName(firstName);
      systemUserVO.setLastName(lastName);
      systemUserVO.setPassword(password);

      if (roleNames != null && roleNames.length > 0) roleNames = null;
      if (groupNames != null && groupNames.length > 0) groupNames = null;

      userControllerProxy.updateUser(systemUserVO, roleNames, groupNames);
    } catch (Exception e) {
      status = new Boolean(false);
      logger.error(
          "En error occurred when we tried to create a new contentVersion:" + e.getMessage(), e);
    }

    updateCaches();

    return status;
  }

  /** Updates a system user. */
  public StatusBean updateUser(
      final String principalName,
      final Object[] inputsArray,
      String[] roleNames,
      String[] groupNames) {
    if (!ServerNodeController.getController().getIsIPAllowed(getRequest())) {
      logger.error(
          "A client with IP "
              + getRequest().getRemoteAddr()
              + " was denied access to the webservice. Could be a hack attempt or you have just not configured the allowed IP-addresses correct.");
      return new StatusBean(false, "You are not allowed to talk to this service");
    }

    StatusBean statusBean = new StatusBean(true, "ok");

    logger.info("***************************************");
    logger.info("Updating user through webservice.......");
    logger.info("***************************************");

    try {
      final DynamicWebserviceSerializer serializer = new DynamicWebserviceSerializer();
      List users = (List) serializer.deserialize(inputsArray);
      logger.info("users:" + users);

      initializePrincipal(principalName);

      Iterator usersIterator = users.iterator();
      while (usersIterator.hasNext()) {
        Map userMap = (Map) usersIterator.next();

        Boolean isPasswordChangeOperation = (Boolean) userMap.get("isPasswordChangeOperation");
        Boolean isPasswordResetOperation = (Boolean) userMap.get("isPasswordResetOperation");

        String firstName = (String) userMap.get("firstName");
        String lastName = (String) userMap.get("lastName");
        String email = (String) userMap.get("email");
        String userName = (String) userMap.get("userName");
        String password = (String) userMap.get("password");
        String oldPassword = (String) userMap.get("oldPassword");

        if (isPasswordChangeOperation) {
          logger.info("isPasswordChangeOperation");
          logger.info("userName:"******"oldPassword:"******"password:"******"isPasswordResetOperation");
          userControllerProxy.updateUserPassword(userName);
        } else {
          logger.info("isUserUpdateOperation");
          SystemUserVO systemUserVO = new SystemUserVO();
          systemUserVO.setEmail(email);
          systemUserVO.setFirstName(firstName);
          systemUserVO.setLastName(lastName);
          systemUserVO.setPassword(password);
          systemUserVO.setUserName(userName);

          if (roleNames != null && roleNames.length == 0) roleNames = null;
          if (groupNames != null && groupNames.length == 0) groupNames = null;

          userControllerProxy.updateUser(systemUserVO, oldPassword, roleNames, groupNames);
        }
      }
    } catch (Throwable e) {
      statusBean.setStatus(false);
      statusBean.setMessage(
          "En error occurred when we tried to update one or more users:" + e.getMessage());
      logger.error(
          "En error occurred when we tried to update one or more users:" + e.getMessage(), e);
    }

    updateCaches();

    return statusBean;
  }

  /** Deletes a system user. */
  public Boolean deleteUser(final String principalName, String userName) {
    if (!ServerNodeController.getController().getIsIPAllowed(getRequest())) {
      logger.error(
          "A client with IP "
              + getRequest().getRemoteAddr()
              + " was denied access to the webservice. Could be a hack attempt or you have just not configured the allowed IP-addresses correct.");
      return new Boolean(false);
    }

    Boolean status = new Boolean(true);

    logger.info("***************************************");
    logger.info("Delete user through webservice.........");
    logger.info("***************************************");

    try {
      initializePrincipal(principalName);

      userControllerProxy.deleteUser(userName);
    } catch (Exception e) {
      status = new Boolean(false);
      logger.error(
          "En error occurred when we tried to create a new contentVersion:" + e.getMessage(), e);
    }

    updateCaches();

    return status;
  }

  /** Gets all roles available. */
  public List<InfoGlueRoleBean> getRoles() {
    if (!ServerNodeController.getController().getIsIPAllowed(getRequest())) {
      logger.error(
          "A client with IP "
              + getRequest().getRemoteAddr()
              + " was denied access to the webservice. Could be a hack attempt or you have just not configured the allowed IP-addresses correct.");
      return null;
    }

    List<InfoGlueRoleBean> roles = new ArrayList<InfoGlueRoleBean>();

    logger.info("***************************************");
    logger.info("Getting all roles through webservice...");
    logger.info("***************************************");

    try {
      List rolesList = RoleControllerProxy.getController().getAllRoles();

      Iterator rolesListIterator = rolesList.iterator();
      while (rolesListIterator.hasNext()) {
        InfoGlueRole role = (InfoGlueRole) rolesListIterator.next();
        InfoGlueRoleBean bean = new InfoGlueRoleBean();
        bean.setName(role.getName());
        bean.setDisplayName(role.getDisplayName());
        bean.setDescription(role.getDescription());
        roles.add(bean);
      }
    } catch (Exception e) {
      logger.error(
          "En error occurred when we tried to create a new contentVersion:" + e.getMessage(), e);
    }

    return roles;
  }

  /** Gets all roles available. */
  public List<InfoGlueGroupBean> getGroups() {
    if (!ServerNodeController.getController().getIsIPAllowed(getRequest())) {
      logger.error(
          "A client with IP "
              + getRequest().getRemoteAddr()
              + " was denied access to the webservice. Could be a hack attempt or you have just not configured the allowed IP-addresses correct.");
      return null;
    }

    List<InfoGlueGroupBean> groups = new ArrayList<InfoGlueGroupBean>();

    logger.info("***************************************");
    logger.info("Getting all groups through webservice..");
    logger.info("***************************************");

    try {
      List groupsList = GroupControllerProxy.getController().getAllGroups();

      Iterator groupsListIterator = groupsList.iterator();
      while (groupsListIterator.hasNext()) {
        InfoGlueGroup group = (InfoGlueGroup) groupsListIterator.next();
        InfoGlueGroupBean bean = new InfoGlueGroupBean();
        bean.setName(group.getName());
        bean.setDisplayName(group.getDisplayName());
        bean.setDescription(group.getDescription());
        groups.add(bean);
      }
    } catch (Exception e) {
      logger.error(
          "En error occurred when we tried to create a new contentVersion:" + e.getMessage(), e);
    }

    return groups;
  }

  /** Gets a principal. */
  public InfoGluePrincipalBean getPrincipal(String userName) {
    if (!ServerNodeController.getController().getIsIPAllowed(getRequest())) {
      logger.error(
          "A client with IP "
              + getRequest().getRemoteAddr()
              + " was denied access to the webservice. Could be a hack attempt or you have just not configured the allowed IP-addresses correct.");
      return null;
    }

    InfoGluePrincipalBean bean = null;

    logger.info("***************************************");
    logger.info("Getting all principals through webservice..");
    logger.info("***************************************");

    try {
      InfoGluePrincipal principal = UserControllerProxy.getController().getUser(userName);

      if (principal != null) {
        bean = new InfoGluePrincipalBean();
        bean.setName(principal.getName());
        bean.setDisplayName(principal.getDisplayName());
        bean.setEmail(principal.getEmail());
        bean.setFirstName(principal.getFirstName());
        bean.setLastName(principal.getLastName());
        bean.setAdministrator(false);
        bean.setMetaInformation(principal.getMetaInformation());

        List groups = new ArrayList();
        Iterator groupsListIterator = principal.getGroups().iterator();
        while (groupsListIterator.hasNext()) {
          InfoGlueGroup group = (InfoGlueGroup) groupsListIterator.next();
          InfoGlueGroupBean groupBean = new InfoGlueGroupBean();
          groupBean.setName(group.getName());
          groupBean.setDisplayName(group.getDisplayName());
          groupBean.setDescription(group.getDescription());
          groups.add(groupBean);
        }
        bean.setGroups(groups);

        List roles = new ArrayList();
        Iterator rolesListIterator = principal.getRoles().iterator();
        while (rolesListIterator.hasNext()) {
          InfoGlueRole role = (InfoGlueRole) rolesListIterator.next();
          InfoGlueRoleBean roleBean = new InfoGlueRoleBean();
          roleBean.setName(role.getName());
          roleBean.setDisplayName(role.getDisplayName());
          roleBean.setDescription(role.getDescription());
          roles.add(roleBean);
        }
        bean.setRoles(roles);
      } else {
        logger.error("User asked for was not in the system:" + userName);
        bean = new InfoGluePrincipalBean();
        bean.setName(userName);
        bean.setDisplayName(userName);
        bean.setEmail("*****@*****.**");
        bean.setFirstName("Not valid user");
        bean.setLastName("");
        bean.setAdministrator(false);

        List groups = new ArrayList();
        bean.setGroups(groups);

        List roles = new ArrayList();
        bean.setRoles(roles);
      }
    } catch (Exception e) {
      logger.error(
          "En error occurred when we tried to create a new contentVersion:" + e.getMessage(), e);
    }

    return bean;
  }

  /** Gets all roles available. */
  public List<InfoGluePrincipalBean> getPrincipals() {
    if (!ServerNodeController.getController().getIsIPAllowed(getRequest())) {
      logger.error(
          "A client with IP "
              + getRequest().getRemoteAddr()
              + " was denied access to the webservice. Could be a hack attempt or you have just not configured the allowed IP-addresses correct.");
      return null;
    }

    List<InfoGluePrincipalBean> users = new ArrayList<InfoGluePrincipalBean>();

    logger.info("***************************************");
    logger.info("Getting all principals through webservice..");
    logger.info("***************************************");

    try {
      List principalList = UserControllerProxy.getController().getAllUsers();

      Iterator principalListIterator = principalList.iterator();
      while (principalListIterator.hasNext()) {
        InfoGluePrincipal principal = (InfoGluePrincipal) principalListIterator.next();
        InfoGluePrincipalBean bean = new InfoGluePrincipalBean();
        bean.setName(principal.getName());
        bean.setDisplayName(principal.getDisplayName());
        bean.setEmail(principal.getEmail());
        bean.setFirstName(principal.getFirstName());
        bean.setLastName(principal.getLastName());
        bean.setAdministrator(false);
        bean.setMetaInformation(principal.getMetaInformation());

        List groups = new ArrayList();
        Iterator groupsListIterator = principal.getGroups().iterator();
        while (groupsListIterator.hasNext()) {
          InfoGlueGroup group = (InfoGlueGroup) groupsListIterator.next();
          InfoGlueGroupBean groupBean = new InfoGlueGroupBean();
          groupBean.setName(group.getName());
          groupBean.setDisplayName(group.getDisplayName());
          groupBean.setDescription(group.getDescription());
          groups.add(groupBean);
        }
        bean.setGroups(groups);

        List roles = new ArrayList();
        Iterator rolesListIterator = principal.getRoles().iterator();
        while (rolesListIterator.hasNext()) {
          InfoGlueRole role = (InfoGlueRole) rolesListIterator.next();
          InfoGlueRoleBean roleBean = new InfoGlueRoleBean();
          roleBean.setName(role.getName());
          roleBean.setDisplayName(role.getDisplayName());
          roleBean.setDescription(role.getDescription());
          roles.add(roleBean);
        }
        bean.setRoles(roles);

        users.add(bean);
      }
    } catch (Exception e) {
      logger.error(
          "En error occurred when we tried to create a new contentVersion:" + e.getMessage(), e);
    }

    return users;
  }

  /** Gets all roles available. */
  public List<InfoGluePrincipalBean> getPrincipalsWithRole(String roleName) {
    if (!ServerNodeController.getController().getIsIPAllowed(getRequest())) {
      logger.error(
          "A client with IP "
              + getRequest().getRemoteAddr()
              + " was denied access to the webservice. Could be a hack attempt or you have just not configured the allowed IP-addresses correct.");
      return null;
    }

    List<InfoGluePrincipalBean> users = new ArrayList<InfoGluePrincipalBean>();

    logger.info("***************************************");
    logger.info("Getting all principals through webservice..");
    logger.info("***************************************");

    try {
      List principalList = RoleControllerProxy.getController().getInfoGluePrincipals(roleName);

      Iterator principalListIterator = principalList.iterator();
      while (principalListIterator.hasNext()) {
        InfoGluePrincipal principal = (InfoGluePrincipal) principalListIterator.next();
        InfoGluePrincipalBean bean = new InfoGluePrincipalBean();
        bean.setName(principal.getName());
        bean.setDisplayName(principal.getDisplayName());
        bean.setEmail(principal.getEmail());
        bean.setFirstName(principal.getFirstName());
        bean.setLastName(principal.getLastName());
        bean.setAdministrator(false);
        bean.setMetaInformation(principal.getMetaInformation());

        List groups = new ArrayList();
        Iterator groupsListIterator = principal.getGroups().iterator();
        while (groupsListIterator.hasNext()) {
          InfoGlueGroup group = (InfoGlueGroup) groupsListIterator.next();
          InfoGlueGroupBean groupBean = new InfoGlueGroupBean();
          groupBean.setName(group.getName());
          groupBean.setDisplayName(group.getDisplayName());
          groupBean.setDescription(group.getDescription());
          groups.add(groupBean);
        }
        bean.setGroups(groups);

        List roles = new ArrayList();
        Iterator rolesListIterator = principal.getRoles().iterator();
        while (rolesListIterator.hasNext()) {
          InfoGlueRole role = (InfoGlueRole) rolesListIterator.next();
          InfoGlueRoleBean roleBean = new InfoGlueRoleBean();
          roleBean.setName(role.getName());
          roleBean.setDisplayName(role.getDisplayName());
          roleBean.setDescription(role.getDescription());
          roles.add(roleBean);
        }
        bean.setRoles(roles);

        users.add(bean);
      }
    } catch (Exception e) {
      logger.error(
          "En error occurred when we tried to create a new contentVersion:" + e.getMessage(), e);
    }

    return users;
  }

  /** Gets all roles available. */
  public List<InfoGluePrincipalBean> getPrincipalsWithGroup(String groupName) {
    if (!ServerNodeController.getController().getIsIPAllowed(getRequest())) {
      logger.error(
          "A client with IP "
              + getRequest().getRemoteAddr()
              + " was denied access to the webservice. Could be a hack attempt or you have just not configured the allowed IP-addresses correct.");
      return null;
    }

    List<InfoGluePrincipalBean> users = new ArrayList<InfoGluePrincipalBean>();

    logger.info("***************************************");
    logger.info("Getting all principals through webservice..");
    logger.info("***************************************");

    try {
      List principalList = GroupControllerProxy.getController().getInfoGluePrincipals(groupName);

      Iterator principalListIterator = principalList.iterator();
      while (principalListIterator.hasNext()) {
        InfoGluePrincipal principal = (InfoGluePrincipal) principalListIterator.next();
        InfoGluePrincipalBean bean = new InfoGluePrincipalBean();
        bean.setName(principal.getName());
        bean.setDisplayName(principal.getDisplayName());
        bean.setEmail(principal.getEmail());
        bean.setFirstName(principal.getFirstName());
        bean.setLastName(principal.getLastName());
        bean.setAdministrator(false);
        bean.setMetaInformation(principal.getMetaInformation());

        List groups = new ArrayList();
        Iterator groupsListIterator = principal.getGroups().iterator();
        while (groupsListIterator.hasNext()) {
          InfoGlueGroup group = (InfoGlueGroup) groupsListIterator.next();
          InfoGlueGroupBean groupBean = new InfoGlueGroupBean();
          groupBean.setName(group.getName());
          groupBean.setDisplayName(group.getDisplayName());
          groupBean.setDescription(group.getDescription());
          groups.add(groupBean);
        }
        bean.setGroups(groups);

        List roles = new ArrayList();
        Iterator rolesListIterator = principal.getRoles().iterator();
        while (rolesListIterator.hasNext()) {
          InfoGlueRole role = (InfoGlueRole) rolesListIterator.next();
          InfoGlueRoleBean roleBean = new InfoGlueRoleBean();
          roleBean.setName(role.getName());
          roleBean.setDisplayName(role.getDisplayName());
          roleBean.setDescription(role.getDescription());
          roles.add(roleBean);
        }
        bean.setRoles(roles);

        users.add(bean);
      }
    } catch (Exception e) {
      logger.error(
          "En error occurred when we tried to create a new contentVersion:" + e.getMessage(), e);
    }

    return users;
  }

  /**
   * Checks if the principal exists and if the principal is allowed to create the workflow.
   *
   * @param userName the name of the user.
   * @param workflowName the name of the workflow to create.
   * @throws SystemException if the principal doesn't exists or doesn't have permission to create
   *     the workflow.
   */
  private void initializePrincipal(final String userName) throws SystemException {
    try {
      principal = UserControllerProxy.getController().getUser(userName);
    } catch (SystemException e) {
      throw e;
    } catch (Exception e) {
      throw new SystemException(e);
    }
    if (principal == null) {
      throw new SystemException("No such principal [" + userName + "].");
    }
  }
}
  /** Gets all roles available. */
  public List<InfoGluePrincipalBean> getPrincipals() {
    if (!ServerNodeController.getController().getIsIPAllowed(getRequest())) {
      logger.error(
          "A client with IP "
              + getRequest().getRemoteAddr()
              + " was denied access to the webservice. Could be a hack attempt or you have just not configured the allowed IP-addresses correct.");
      return null;
    }

    List<InfoGluePrincipalBean> users = new ArrayList<InfoGluePrincipalBean>();

    logger.info("***************************************");
    logger.info("Getting all principals through webservice..");
    logger.info("***************************************");

    try {
      List principalList = UserControllerProxy.getController().getAllUsers();

      Iterator principalListIterator = principalList.iterator();
      while (principalListIterator.hasNext()) {
        InfoGluePrincipal principal = (InfoGluePrincipal) principalListIterator.next();
        InfoGluePrincipalBean bean = new InfoGluePrincipalBean();
        bean.setName(principal.getName());
        bean.setDisplayName(principal.getDisplayName());
        bean.setEmail(principal.getEmail());
        bean.setFirstName(principal.getFirstName());
        bean.setLastName(principal.getLastName());
        bean.setAdministrator(false);
        bean.setMetaInformation(principal.getMetaInformation());

        List groups = new ArrayList();
        Iterator groupsListIterator = principal.getGroups().iterator();
        while (groupsListIterator.hasNext()) {
          InfoGlueGroup group = (InfoGlueGroup) groupsListIterator.next();
          InfoGlueGroupBean groupBean = new InfoGlueGroupBean();
          groupBean.setName(group.getName());
          groupBean.setDisplayName(group.getDisplayName());
          groupBean.setDescription(group.getDescription());
          groups.add(groupBean);
        }
        bean.setGroups(groups);

        List roles = new ArrayList();
        Iterator rolesListIterator = principal.getRoles().iterator();
        while (rolesListIterator.hasNext()) {
          InfoGlueRole role = (InfoGlueRole) rolesListIterator.next();
          InfoGlueRoleBean roleBean = new InfoGlueRoleBean();
          roleBean.setName(role.getName());
          roleBean.setDisplayName(role.getDisplayName());
          roleBean.setDescription(role.getDescription());
          roles.add(roleBean);
        }
        bean.setRoles(roles);

        users.add(bean);
      }
    } catch (Exception e) {
      logger.error(
          "En error occurred when we tried to create a new contentVersion:" + e.getMessage(), e);
    }

    return users;
  }
  /** Gets a principal. */
  public InfoGluePrincipalBean getPrincipal(String userName) {
    if (!ServerNodeController.getController().getIsIPAllowed(getRequest())) {
      logger.error(
          "A client with IP "
              + getRequest().getRemoteAddr()
              + " was denied access to the webservice. Could be a hack attempt or you have just not configured the allowed IP-addresses correct.");
      return null;
    }

    InfoGluePrincipalBean bean = null;

    logger.info("***************************************");
    logger.info("Getting all principals through webservice..");
    logger.info("***************************************");

    try {
      InfoGluePrincipal principal = UserControllerProxy.getController().getUser(userName);

      if (principal != null) {
        bean = new InfoGluePrincipalBean();
        bean.setName(principal.getName());
        bean.setDisplayName(principal.getDisplayName());
        bean.setEmail(principal.getEmail());
        bean.setFirstName(principal.getFirstName());
        bean.setLastName(principal.getLastName());
        bean.setAdministrator(false);
        bean.setMetaInformation(principal.getMetaInformation());

        List groups = new ArrayList();
        Iterator groupsListIterator = principal.getGroups().iterator();
        while (groupsListIterator.hasNext()) {
          InfoGlueGroup group = (InfoGlueGroup) groupsListIterator.next();
          InfoGlueGroupBean groupBean = new InfoGlueGroupBean();
          groupBean.setName(group.getName());
          groupBean.setDisplayName(group.getDisplayName());
          groupBean.setDescription(group.getDescription());
          groups.add(groupBean);
        }
        bean.setGroups(groups);

        List roles = new ArrayList();
        Iterator rolesListIterator = principal.getRoles().iterator();
        while (rolesListIterator.hasNext()) {
          InfoGlueRole role = (InfoGlueRole) rolesListIterator.next();
          InfoGlueRoleBean roleBean = new InfoGlueRoleBean();
          roleBean.setName(role.getName());
          roleBean.setDisplayName(role.getDisplayName());
          roleBean.setDescription(role.getDescription());
          roles.add(roleBean);
        }
        bean.setRoles(roles);
      } else {
        logger.error("User asked for was not in the system:" + userName);
        bean = new InfoGluePrincipalBean();
        bean.setName(userName);
        bean.setDisplayName(userName);
        bean.setEmail("*****@*****.**");
        bean.setFirstName("Not valid user");
        bean.setLastName("");
        bean.setAdministrator(false);

        List groups = new ArrayList();
        bean.setGroups(groups);

        List roles = new ArrayList();
        bean.setRoles(roles);
      }
    } catch (Exception e) {
      logger.error(
          "En error occurred when we tried to create a new contentVersion:" + e.getMessage(), e);
    }

    return bean;
  }
  public String doUserListForPopup() throws Exception {
    this.infogluePrincipals = UserControllerProxy.getController().getAllUsers();
    Collections.sort(this.infogluePrincipals, new ReflectionComparator("firstName"));

    return "successPopup";
  }
  /** Updates a system user. */
  public StatusBean updateUser(
      final String principalName,
      final Object[] inputsArray,
      String[] roleNames,
      String[] groupNames) {
    if (!ServerNodeController.getController().getIsIPAllowed(getRequest())) {
      logger.error(
          "A client with IP "
              + getRequest().getRemoteAddr()
              + " was denied access to the webservice. Could be a hack attempt or you have just not configured the allowed IP-addresses correct.");
      return new StatusBean(false, "You are not allowed to talk to this service");
    }

    StatusBean statusBean = new StatusBean(true, "ok");

    logger.info("***************************************");
    logger.info("Updating user through webservice.......");
    logger.info("***************************************");

    try {
      final DynamicWebserviceSerializer serializer = new DynamicWebserviceSerializer();
      List users = (List) serializer.deserialize(inputsArray);
      logger.info("users:" + users);

      initializePrincipal(principalName);

      Iterator usersIterator = users.iterator();
      while (usersIterator.hasNext()) {
        Map userMap = (Map) usersIterator.next();

        Boolean isPasswordChangeOperation = (Boolean) userMap.get("isPasswordChangeOperation");
        Boolean isPasswordResetOperation = (Boolean) userMap.get("isPasswordResetOperation");

        String firstName = (String) userMap.get("firstName");
        String lastName = (String) userMap.get("lastName");
        String email = (String) userMap.get("email");
        String userName = (String) userMap.get("userName");
        String password = (String) userMap.get("password");
        String oldPassword = (String) userMap.get("oldPassword");

        if (isPasswordChangeOperation) {
          logger.info("isPasswordChangeOperation");
          logger.info("userName:"******"oldPassword:"******"password:"******"isPasswordResetOperation");
          userControllerProxy.updateUserPassword(userName);
        } else {
          logger.info("isUserUpdateOperation");
          SystemUserVO systemUserVO = new SystemUserVO();
          systemUserVO.setEmail(email);
          systemUserVO.setFirstName(firstName);
          systemUserVO.setLastName(lastName);
          systemUserVO.setPassword(password);
          systemUserVO.setUserName(userName);

          if (roleNames != null && roleNames.length == 0) roleNames = null;
          if (groupNames != null && groupNames.length == 0) groupNames = null;

          userControllerProxy.updateUser(systemUserVO, oldPassword, roleNames, groupNames);
        }
      }
    } catch (Throwable e) {
      statusBean.setStatus(false);
      statusBean.setMessage(
          "En error occurred when we tried to update one or more users:" + e.getMessage());
      logger.error(
          "En error occurred when we tried to update one or more users:" + e.getMessage(), e);
    }

    updateCaches();

    return statusBean;
  }
  /**
   * This method saves all application settings by grabbing the stated parameter values from the
   * request.
   */
  public String doSave() throws Exception {
    validateSecurityCode();

    Map args = new HashMap();
    args.put("globalKey", "infoglue");
    PropertySet ps = PropertySetManager.getInstance("jdbc", args);

    populate(ps, "isPageCacheOn");
    populate(ps, "useSelectivePageCacheUpdate");
    populate(ps, "expireCacheAutomatically");
    populate(ps, "cacheExpireInterval");
    populate(ps, "deliverRequestTimeout");
    populate(ps, "liveDeliverRequestTimeout");
    populate(ps, "killLiveRequestWhichTimedout");
    populate(ps, "useHighLoadLimiter");
    populate(ps, "maxActiveRequests");
    populate(ps, "maxRequestTime");
    populate(ps, "session.timeout");
    populate(ps, "compressPageCache");
    populate(ps, "compressPageResponse");
    populate(ps, "disableDecoratedFinalRendering");
    populate(ps, "siteNodesToRecacheOnPublishing");
    populate(ps, "recachePublishingMethod");
    populate(ps, "recacheUrl");
    populate(ps, "useUpdateSecurity");
    populate(ps, "allowXForwardedIPCheck");

    populate(ps, "allowedAdminIP");
    String allowedAdminIP = this.getRequest().getParameter("allowedAdminIP");
    if (allowedAdminIP != null && !allowedAdminIP.equals(""))
      ServerNodeController.getController().setAllowedAdminIP(allowedAdminIP);

    populate(ps, "pageKey");
    populate(ps, "componentKey");
    populateData(ps, "cacheSettings");
    populateData(ps, "extraPublicationPersistentCacheNames");
    populate(ps, "cmsBaseUrl");
    populate(ps, "cmsFullBaseUrl");
    populate(ps, "componentEditorUrl");
    populate(ps, "componentRendererUrl");
    populate(ps, "componentRendererAction");
    populate(ps, "editOnSiteUrl");
    populate(ps, "useFreeMarker");
    populate(ps, "webServerAddress");
    populate(ps, "applicationBaseAction");
    populate(ps, "digitalAssetBaseUrl");
    populate(ps, "imagesBaseUrl");
    populate(ps, "digitalAssetPath");
    populate(ps, "urlFormatting");
    populate(ps, "enableNiceURI");
    populate(ps, "enableNiceURIInWorking");
    populate(ps, "enableNiceURIForLanguage");
    populate(ps, "enableDiskAssets");
    populate(ps, "disableAssetDeletionInWorkThread");
    populate(ps, "disableAssetDeletionInLiveThread");
    populate(ps, "niceURIEncoding");
    populate(ps, "niceURIAttributeName");
    populateData(ps, "niceURICharacterReplacingMapping");
    populate(ps, "niceURIUseLowerCase");
    populate(ps, "niceURIDefaultReplacementCharacter");
    populate(ps, "niceURIDisableNiceURIForContent");
    populate(ps, "niceURIDefaultReplacementCharacterForContent");
    populate(ps, "duplicateAssetsBetweenVersions");
    populate(ps, "requestArgumentDelimiter");
    populate(ps, "errorHandling");
    populate(ps, "errorUrl");
    populate(ps, "errorBusyUrl");
    populate(ps, "externalThumbnailGeneration");
    populate(ps, "URIEncoding");
    populate(ps, "workflowEncoding");
    populate(ps, "formsEncoding");
    populate(ps, "uploadFromEncoding");
    populate(ps, "uploadToEncoding");
    populate(ps, "assetKeyFromEncoding");
    populate(ps, "assetKeyToEncoding");
    populate(ps, "enableCustomCharactersParsing");
    populate(ps, "customCharactersForConversion");
    populate(ps, "useShortTableNames");
    populate(ps, "useImprovedContentCategorySearch");
    populate(ps, "logDatabaseMessages");
    populate(ps, "statistics.enabled");
    populate(ps, "statisticsLogPath");
    populate(ps, "statisticsLogOneFilePerDay");
    populate(ps, "statisticsLogger");
    populate(ps, "contactPersonEmailMetaInfoAttribute");
    populate(ps, "notifyResponsibleOnReferenceChange");
    populate(ps, "enablePortal");
    populate(ps, "portletBase");
    populate(ps, "mail.smtp.host");
    populate(ps, "mail.smtp.port");
    populate(ps, "mail.smtp.auth");
    populate(ps, "mail.smtp.user");
    populate(ps, "mail.smtp.password");
    populate(ps, "mail.contentType");
    populate(ps, "systemEmailSender");
    populate(ps, "warningEmailReceiver");
    populate(ps, "emailRecipientLimit");
    populate(ps, "loginUrl");
    populate(ps, "logoutUrl");
    populate(ps, "invalidLoginUrl");
    populate(ps, "successLoginBaseUrl");
    populate(ps, "authenticatorClass");
    populate(ps, "authorizerClass");
    populate(ps, "serverName");
    populate(ps, "authConstraint");
    populate(ps, "extraParametersFile");
    populateData(ps, "extraSecurityParameters");
    populate(ps, "casValidateUrl");
    populate(ps, "casProxyValidateUrl");
    populate(ps, "casServiceUrl");
    populate(ps, "casLogoutUrl");
    populate(ps, "ipAddressesToFallbackToBasicAuth");

    populate(ps, "deliver_loginUrl");
    populate(ps, "deliver_logoutUrl");
    populate(ps, "deliver_invalidLoginUrl");
    populate(ps, "deliver_successLoginBaseUrl");
    populate(ps, "deliver_authenticatorClass");
    populate(ps, "deliver_authorizerClass");
    populate(ps, "deliver_serverName");
    populate(ps, "deliver_authConstraint");
    populate(ps, "deliver_extraParametersFile");
    populateData(ps, "deliver_extraSecurityParameters");
    populate(ps, "deliver_security.anonymous.username");
    populate(ps, "deliver_security.anonymous.password");
    populate(ps, "deliver_casValidateUrl");
    populate(ps, "deliver_casProxyValidateUrl");
    populate(ps, "deliver_casServiceUrl");
    populate(ps, "deliver_casLogoutUrl");

    populate(ps, "workingStyleInformation");
    populate(ps, "finalStyleInformation");
    populate(ps, "publishStyleInformation");
    populate(ps, "publishedStyleInformation");
    populateData(ps, "customContentTypeIcons");
    populateData(ps, "shortcuts");
    populateData(ps, "WYSIWYGToolbarComboPreviewCSS");
    populateData(ps, "WYSIWYGEditorAreaCSS");

    populate(ps, "disableImageEditor");
    populate(ps, "hideProtectedProperties");

    populate(ps, "protectContentTypes");
    populate(ps, "protectWorkflows");
    populate(ps, "protectCategories");

    populate(ps, "internalSearchEngine");
    populate(ps, "allowOverrideModifyer");

    populate(ps, "useSimpleComponentDialog");
    populate(ps, "hideAccessRightsIfNotAllowedToManage");
    populate(ps, "onlyAllowFolderType");
    populate(ps, "allowedFolderContentTypeNames");
    populate(ps, "skipResultDialogIfPossible");

    populate(ps, "maxRows");
    populate(ps, "maxNumberOfAssetInSearches");
    populate(ps, "gaCode");
    populate(ps, "componentBindningAssetBrowser");
    populate(ps, "prefferedWYSIWYG");

    populate(ps, "defaultNumberOfYearsBeforeExpire");
    populate(ps, "defaultNumberOfMonthsBeforeRedirectExpire");
    populate(ps, "defaultNumberOfMonthsBeforeSystemRedirectExpire");
    populate(ps, "enableDateTimeDirectEditing");
    populate(ps, "showContentVersionFirst");
    populate(ps, "tree");
    populate(ps, "treemode");
    populate(ps, "disableCustomIcons");
    populate(ps, "showComponentsFirst");
    populate(ps, "showAllWorkflows");
    populate(ps, "editOnSight");
    populate(ps, "previewDeliveryUrl");
    populate(ps, "stagingDeliveryUrl");
    populateData(ps, "internalDeliveryUrls");
    populateData(ps, "publicDeliveryUrls");
    populateData(ps, "toolLanguages");
    populateData(ps, "deploymentServers");
    populateData(ps, "vcServers");
    populate(ps, "decoratedPageInvoker");
    populate(ps, "defaultRepositoryAccessRoles");

    populate(ps, "edition.pageSize");
    populate(ps, "content.tree.sort");
    populate(ps, "structure.tree.sort");
    populate(ps, "structure.tree.isHidden");
    populate(ps, "content.tree.hideForbidden");
    populate(ps, "structure.tree.hideForbidden");
    populate(ps, "enforceRigidContentAccess");
    populate(ps, "disableEmptyUrls");
    populate(ps, "cacheUpdateAction");
    populate(ps, "logPath");

    populate(ps, "logTransactions");
    populate(ps, "enableExtranetCookies");
    populate(ps, "useAlternativeBrowserLanguageCheck");
    populate(ps, "caseSensitiveRedirects");
    populate(ps, "useDNSNameInURI");

    populate(ps, "extranetCookieTimeout");
    populate(ps, "webServicesBaseUrl");
    populate(ps, "livePublicationThreadClass");
    populate(ps, "publicationThreadDelay");
    populate(ps, "pathsToRecacheOnPublishing");
    populate(ps, "disableTemplateDebug");
    populate(ps, "exportFormat");
    populate(ps, "dbRelease");
    populate(ps, "dbUser");
    populate(ps, "dbPassword");
    populate(ps, "masterServer");
    populate(ps, "slaveServer");
    populate(ps, "buildName");
    populate(ps, "adminToolsPath");
    populate(ps, "dbScriptPath");
    populate(ps, "digitalAssetUploadPath");
    populate(ps, "inputCharacterEncoding");
    populate(ps, "deliver_inputCharacterEncoding");
    populate(ps, "protectDeliverWorking");
    populate(ps, "protectDeliverPreview");
    populate(ps, "forceIdentityCheck");
    populate(ps, "allowCrossSiteSubmitToPublish");
    populate(ps, "usePasswordEncryption");
    populate(ps, "helpUrl");
    populateData(ps, "headerHTML");

    populate(ps, "allowPublicationEventFilter");
    populate(ps, "defaultPublicationEventFilter");

    populate(ps, "numberOfVersionsToKeepDuringClean");
    populate(ps, "keepOnlyOldPublishedVersionsDuringClean");
    populate(ps, "minimumTimeBetweenVersionsDuringClean");
    populateData(ps, "assetUploadTransformationsSettings");

    populate(ps, "setDerivedLastModifiedInLive");
    populate(ps, "standardResponseHeaders");
    populate(ps, "maxNumberOfVersionsForDerivedLastModifiedInLive");
    populate(ps, "allowInternalCallsBasedOnIP");

    populate(ps, "assetFileNameForm");

    populate(ps, "deriveProtocolWhenUsingProtocolRedirects");
    populate(ps, "useAccessBasedProtocolRedirects");
    populate(ps, "unprotectedProtocolName");
    populate(ps, "protectedProtocolName");
    populate(ps, "unprotectedProtocolPort");
    populate(ps, "protectedProtocolPort");
    populate(ps, "accessBasedProtocolRedirectHTTPCode");
    populate(ps, "redirectStatusCode");

    populate(ps, "indexDigitalAssetContent");

    populate(ps, "allowedDirectLoginNames");

    populate(ps, "onlyShowReferenceIfLatestVersion");
    populate(ps, "registryContactMailLanguage");

    try {
      UserControllerProxy.getController().updateAnonymousUserPassword();
    } catch (SystemException e) {
      e.printStackTrace();
    }

    try {
      CacheController.clearServerNodeProperty(true);
      InfoGlueAuthenticationFilter.initializeCMSProperties();
    } catch (SystemException e) {
      e.printStackTrace();
    }

    NotificationMessage notificationMessage =
        new NotificationMessage(
            "ViewServerNodePropertiesAction.doSave():",
            "ServerNodeProperties",
            this.getInfoGluePrincipal().getName(),
            NotificationMessage.SYSTEM,
            "0",
            "ServerNodeProperties");
    // ChangeNotificationController.getInstance().addNotificationMessage(notificationMessage);
    RemoteCacheUpdater.getSystemNotificationMessages().add(notificationMessage);

    return "save";
  }