コード例 #1
0
  /** 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;
  }
コード例 #2
0
  /** 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;
  }
コード例 #3
0
  /** 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;
  }
コード例 #4
0
  protected void initialize(Integer serverNodeId) throws Exception {
    if (serverNodeId != null && serverNodeId.intValue() > -1)
      this.serverNodeVO = ServerNodeController.getController().getServerNodeVOWithId(serverNodeId);
    else {
      this.serverNodeVO.setName("Default");
    }

    Map args = new HashMap();
    args.put("globalKey", "infoglue");
    this.propertySet = PropertySetManager.getInstance("jdbc", args);
  }
コード例 #5
0
  /** 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;
  }
コード例 #6
0
  /** 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;
  }
コード例 #7
0
  /** 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;
  }
コード例 #8
0
  /** The main method that fetches the Value-objects for this use-case */
  public String doExecute() throws Exception {
    this.serverNodeVOList = ServerNodeController.getController().getServerNodeVOList();
    this.initialize(getServerNodeId());

    return "success";
  }
コード例 #9
0
  /**
   * 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";
  }