Package com.liferay.portal.model

Examples of com.liferay.portal.model.Company


      ActionResponse actionResponse) throws Exception {
   
    ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(
        WebKeys.THEME_DISPLAY);

    Company company = themeDisplay.getCompany();
   
    String cmd = ParamUtil.getString(actionRequest, Constants.CMD);
   
    System.out.println("Wrapped /login/create_account, cmd: "+cmd);
   
    if (cmd.equals(Constants.ADD)) {
     
      String warrantUserUniqueId = ParamUtil.getString(actionRequest, "ExpandoAttribute--warrantUserUniqueId--");

      WarrantUserUniqueId warrantUserUniqueID =
          this.checkWarrantUserUniqueId(actionRequest, actionResponse, warrantUserUniqueId);
   
      if(warrantUserUniqueID != null){
       
        System.out.println("warrantUserUniqueID: " + warrantUserUniqueID);
       
        originalStrutsPortletAction.processAction(originalStrutsPortletAction,
            portletConfig, actionRequest, actionResponse);

        String screenName = ParamUtil.getString(actionRequest, "screenName");

        User fetchUserByScreenName = UserLocalServiceUtil.fetchUserByScreenName(company.getCompanyId(), screenName);

        long userId = fetchUserByScreenName.getUserId();

        System.out.println("userId: " + userId);
View Full Code Here


  @Override
  public Company checkCompany(String webId, String mx, String shardName)
    throws PortalException, SystemException {

    Company company = super.checkCompany(webId, mx, shardName);

    InstanceUtil.initInstance(company.getCompanyId());

    return company;
  }
View Full Code Here

        RoleConstants.TYPE_SITE_LABEL, serviceContext);
    }
  }

  private static void _localizeUsers(long companyId) throws Exception {
    Company company = CompanyLocalServiceUtil.getCompany(companyId);

    ExpandoBridge expandoBridge = company.getExpandoBridge();

    String attributeName =
      "localizationUpdated_" + PortletPropsValues.COMPANY_DEFAULT_LOCALE;

    boolean localizationUpdated = GetterUtil.getBoolean(
View Full Code Here

      for (String companyIdAsString : companyIds) {

        long companyId = Long.parseLong(companyIdAsString);
        setupPermissionChecker(companyId);

        Company company = CompanyLocalServiceUtil.getCompanyById(companyId);
        long userId = company.getDefaultUser().getUserId();
        setupUsers(companyId, userId);
        setupSites(companyId, userId);
        clearPermissionChecker();
      }
    }
View Full Code Here

      }

      case UserPasswordException.PASSWORD_LENGTH: {

        try {
          Company company = CompanyLocalServiceUtil.getCompany(companyId);
          PasswordPolicy passwordPolicy = company.getDefaultUser().getPasswordPolicy();
          liferayFacesContext.addGlobalErrorMessage(
            "that-password-is-too-short-or-too-long-please-make-sure-your-password-is-between-x-and-512-characters",
            new Object[] { String.valueOf(passwordPolicy.getMinLength()) });

        }
        catch (Exception e1) {
          logger.error(e.getMessage(), e);
          liferayFacesContext.addGlobalUnexpectedErrorMessage();
        }

        break;
      }

      case UserPasswordException.PASSWORD_NOT_CHANGEABLE: {
        liferayFacesContext.addGlobalErrorMessage("your-password-cannot-be-changed");

        break;
      }

      case UserPasswordException.PASSWORD_SAME_AS_CURRENT: {
        liferayFacesContext.addGlobalErrorMessage(
          "your-new-password-cannot-be-the-same-as-your-old-password-please-enter-in-a-different-password");

        break;
      }

      case UserPasswordException.PASSWORD_TOO_TRIVIAL: {
        liferayFacesContext.addGlobalErrorMessage("that-password-is-too-trivial");

        break;
      }

      case UserPasswordException.PASSWORD_TOO_YOUNG: {

        try {
          Company company = CompanyLocalServiceUtil.getCompany(companyId);
          PasswordPolicy passwordPolicy = company.getDefaultUser().getPasswordPolicy();
          liferayFacesContext.addGlobalErrorMessage(
            "you-cannot-change-your-password-yet-please-wait-at-least-x-before-changing-your-password-again",
            new Object[] { String.valueOf(passwordPolicy.getMinAge() * 1000) });

        }
View Full Code Here

      LiferayFacesContext liferayFacesContext = LiferayFacesContext.getInstance();

      try {
        ThemeDisplay themeDisplay = liferayFacesContext.getThemeDisplay();
        Company company = themeDisplay.getCompany();

        authType = company.getAuthType();
      }
      catch (SystemException e) {
        logger.error(e);
        liferayFacesContext.addGlobalErrorMessage("Unable to determine authentication type");
        authType = CompanyConstants.AUTH_TYPE_EA;
View Full Code Here

             else
                user = APILocator.getUserAPI().loadUserById(decryptedId,APILocator.getUserAPI().getSystemUser(),false);
            /* End of Custom Code */
            try {
                String userName = user.getEmailAddress();
                Company comp = com.dotmarketing.cms.factories.PublicCompanyFactory.getDefaultCompany();
                if (comp.getAuthType().equals(Company.AUTH_TYPE_ID)) {
                  userName = user.getUserId();
                }

                return doLogin(userName, user.getPassword(), true, request, response);
            } catch (Exception e) { // $codepro.audit.disable logExceptions
            SecurityLogger.logInfo(LoginFactory.class,"An invalid attempt to login (No user found) from IP: " + request.getRemoteAddr() + " :  " + e );

              return false;
            }
        } catch (Exception e) {
        SecurityLogger.logInfo(LoginFactory.class,"Auto login failed (No user found) from IP: " + request.getRemoteAddr() + " :  " + e );


            if(useSalesForceLoginFilter){
              String decryptedId = PublicEncryptionFactory.decryptString(encryptedId);
              Logger.info(LoginFactory.class, "Try to retrieve user from SalesForce with id: " + decryptedId);
              User newUser = SalesForceUtils.migrateUserFromSalesforce(decryptedId, request,  response, true);

              if(UtilMethods.isSet(newUser)){
                 User user = null;
                 Company comp = com.dotmarketing.cms.factories.PublicCompanyFactory.getDefaultCompany();
                     try {
                   if (comp.getAuthType().equals(Company.AUTH_TYPE_EA)) {
                        user = APILocator.getUserAPI().loadByUserByEmail(decryptedId, APILocator.getUserAPI().getSystemUser(), false);
                      } else {
                        user = APILocator.getUserAPI().loadUserById(decryptedId, APILocator.getUserAPI().getSystemUser(), false);
                      }

View Full Code Here

     */
    public static boolean doLogin(String userName, String password, boolean rememberMe, HttpServletRequest request, HttpServletResponse response) throws NoSuchUserException {
        try {
          User user = null;
          boolean match = false;
          Company comp = com.dotmarketing.cms.factories.PublicCompanyFactory.getDefaultCompany();

          if (comp.getAuthType().equals(Company.AUTH_TYPE_EA)) {
        if(userName.equalsIgnoreCase(APILocator.getUserAPI().getSystemUser().getEmailAddress())){
              SecurityLogger.logInfo(LoginFactory.class,"An invalid attempt to login with email as " + userName + " from IP: " + request.getRemoteAddr());

          return false;
        }
      } else {
        if(userName.equalsIgnoreCase(APILocator.getUserAPI().getSystemUser().getUserId())){
              SecurityLogger.logInfo(LoginFactory.class,"An invalid attempt to login with userID as " + userName + " from IP: " + request.getRemoteAddr());

          return false;
        }
      }

          if ((PRE_AUTHENTICATOR != null) &&
            (0 < PRE_AUTHENTICATOR.length()) &&
            PRE_AUTHENTICATOR.equals(Config.getStringProperty("LDAP_FRONTEND_AUTH_IMPLEMENTATION"))) {
            Class ldap_auth_impl_class = Class.forName(Config.getStringProperty("LDAP_FRONTEND_AUTH_IMPLEMENTATION"));
            Authenticator ldap_auth_impl = (Authenticator) ldap_auth_impl_class.newInstance();
            int auth = 0;

          if (comp.getAuthType().equals(Company.AUTH_TYPE_EA)) {
            auth = ldap_auth_impl.authenticateByEmailAddress(comp.getCompanyId(), userName, password);
        } else {
          auth = ldap_auth_impl.authenticateByUserId(comp.getCompanyId(), userName, password);
        }

          if (comp.getAuthType().equals(Company.AUTH_TYPE_EA)) {
                user = APILocator.getUserAPI().loadByUserByEmail(userName, APILocator.getUserAPI().getSystemUser(), false);
              } else {
                user = APILocator.getUserAPI().loadUserById(userName, APILocator.getUserAPI().getSystemUser(), false);
              }

          try{
            boolean SYNC_PASSWORD = BaseAuthenticator.SYNC_PASSWORD;
            if(!SYNC_PASSWORD){
              String roleName = LDAPImpl.LDAP_USER_ROLE;
              if(com.dotmarketing.business.APILocator.getRoleAPI().doesUserHaveRole(user, roleName)){
                user.setPassword(DotCustomLoginPostAction.FAKE_PASSWORD);
                APILocator.getUserAPI().save(user,APILocator.getUserAPI().getSystemUser(),false);
              }
            }
          }catch (Exception e) {
            Logger.debug(LoginFactory.class, "syncPassword not set or unable to load user", e);
          }

          match = auth == Authenticator.SUCCESS;
          } else {
              if (comp.getAuthType().equals(Company.AUTH_TYPE_EA)) {
                user = APILocator.getUserAPI().loadByUserByEmail(userName, APILocator.getUserAPI().getSystemUser(), false);
              } else {
                user = APILocator.getUserAPI().loadUserById(userName, APILocator.getUserAPI().getSystemUser(), false);
              }

View Full Code Here

                  return af;
                } else
                  return mapping.findForward("loginPage");
            } else {
              User user = null;
                Company company = PublicCompanyFactory.getDefaultCompany();
              if (company.getAuthType().equals(Company.AUTH_TYPE_EA)) {
                user = APILocator.getUserAPI().loadByUserByEmail(form.getUserName().toLowerCase(), APILocator.getUserAPI().getSystemUser(), false);
                } else {
                  user = APILocator.getUserAPI().loadUserById(form.getUserName().toLowerCase(),APILocator.getUserAPI().getSystemUser(),false);
                }
              ActionForward af = new ActionForward(SecurityUtils.stripReferer(request, mapping.findForward("challengeQuestionPage").getPath() + "?emailAddress=" + user.getEmailAddress()));
View Full Code Here

    private boolean isUserInactive(LoginForm form, HttpServletRequest request) throws NoSuchUserException {
        try {

          String userName = form.getUserName();

            Company comp = com.dotmarketing.cms.factories.PublicCompanyFactory.getDefaultCompany();
            User user = null;

            if (comp.getAuthType().equals(Company.AUTH_TYPE_EA)) {
              user = APILocator.getUserAPI().loadByUserByEmail(userName, APILocator.getUserAPI().getSystemUser(), false);
            } else {
              user = APILocator.getUserAPI().loadUserById(userName,APILocator.getUserAPI().getSystemUser(),false);
            }
View Full Code Here

TOP

Related Classes of com.liferay.portal.model.Company

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.