当前位置: 首页>>代码示例>>Java>>正文


Java UserLocalServiceUtil.getUserByEmailAddress方法代码示例

本文整理汇总了Java中com.liferay.portal.service.UserLocalServiceUtil.getUserByEmailAddress方法的典型用法代码示例。如果您正苦于以下问题:Java UserLocalServiceUtil.getUserByEmailAddress方法的具体用法?Java UserLocalServiceUtil.getUserByEmailAddress怎么用?Java UserLocalServiceUtil.getUserByEmailAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.liferay.portal.service.UserLocalServiceUtil的用法示例。


在下文中一共展示了UserLocalServiceUtil.getUserByEmailAddress方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validate

import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
@Override
public void validate(final Object target, final Errors errors) {
	final ProfileForm form = (ProfileForm) target;

	User user = null;
	try {
		user = UserLocalServiceUtil.getUserByEmailAddress(
		        this.m_objDisplay.getCompanyId(), form.getMail());
	} catch (final Throwable t) {
	}

	if (user != null) {
		errors.rejectValue("mail", "notExistentErrorCode",
		        "org.intern.tabs.user.form.addUser.field.mail.exists");
	}

	/*
	 * if (form.getPass1() != null && form.getPass2() != null) { if
	 * (!form.getPass1().equals(form.getPass2())) {
	 * errors.rejectValue("pass1", "notExistentErrorCode",
	 * "org.intern.tabs.user.form.addUser.field.pass.invalid");
	 * errors.rejectValue("pass2", "notExistentErrorCode",
	 * "org.intern.tabs.user.form.addUser.field.pass.invalid");
	 * form.setPass1(""); form.setPass2(""); } } else {
	 * errors.rejectValue("pass1", "notExistentErrorCode",
	 * "org.intern.tabs.user.form.addUser.field.pass.empty"); }
	 */

}
 
开发者ID:fraunhoferfokus,项目名称:particity,代码行数:30,代码来源:ProfileFormValidator.java

示例2: initOrganisations

import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
public void initOrganisations(List<OrganisationType> organisations) {
	if (organisations != null && organisations.size() > 0) {
		de.particity.util.PersistentLog.Log log = PersistentLog.getInstance().addLog(LOG_ORGANISATIONS);
		for (OrganisationType org: organisations) {
			AHOrg dborg = CustomOrgServiceHandler.addOrganisation(m_objCompanyId, m_objUserId, m_objGroupId, org.getOwner(), org.getName(), org.getHolder(), org.getDescription(), org.getLegalStatus(), org.getAddress().getStreet(), org.getAddress().getHouse(), org.getAddress().getCity(), org.getAddress().getCountry(), org.getAddress().getZip(), org.getContact().getPhone(), org.getContact().getFax(), org.getContact().getEmail(), org.getContact().getWww(), null, org.getAddress().getCoordLat(), org.getAddress().getCoordLon());
			if (dborg != null) {
				log.log(org.getName());
				CustomOrgServiceHandler.updateLogo(m_objCompanyId, m_objUserId, m_objGroupId, dborg.getOrgId(), org.getLogo(), org.getLogoFilename());
				
				User lrUser = null;
				try {
					lrUser = UserLocalServiceUtil.getUserByEmailAddress(m_objCompanyId, org.getOwner());
				} catch (Throwable t) {}
				if (lrUser == null) {
					lrUser = CustomPortalServiceHandler.createPortalUser(org.getName(), org.getHolder(), org.getOwner(), m_objCompanyId, m_objGroupId, Locale.GERMAN, false);
					lrUser.setPassword(org.getLoginPassword());
					lrUser.setAgreedToTermsOfUse(true);
					lrUser.setEmailAddressVerified(true);
					try {
	                    UserLocalServiceUtil.updateUser(lrUser);
                    } catch (Throwable e) {
	                    m_objLog.warn("Could not update user password for user "+org.getOwner()+" id "+lrUser.getUserId());
                    }
				}

				m_objOrgIdMap.put(org.getOrgId(), dborg.getOrgId());
			} else {
				log.err(org.getName());
			}
		}
	}
}
 
开发者ID:fraunhoferfokus,项目名称:particity,代码行数:33,代码来源:ImportWriter.java

示例3: loginByEmail

import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
private User loginByEmail(long companyId, String login)
        throws NoSuchUserException, Exception {
    return UserLocalServiceUtil.getUserByEmailAddress(companyId, login);
}
 
开发者ID:publisys-spa,项目名称:shibboleth-spid-login-hook,代码行数:5,代码来源:ShibbolethAutoLogin.java

示例4: validate

import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
@Override
public void validate(final Object target, final Errors errors) {
	final ProfileForm form = (ProfileForm) target;

	final User user = this.m_objDisplay.getUser();

	final String oldMail = user.getEmailAddress();
	final String newMail = form.getMail();
	if (newMail != null
	        && newMail.trim().length() > 0
	        && !newMail.toLowerCase().trim()
	                .equals(oldMail.toLowerCase().trim())) {
		final AHOrg newOrg = AHOrgLocalServiceUtil
		        .getOrganisationByOwnerMail(newMail.toLowerCase().trim());
		if (newOrg != null) {
			errors.rejectValue("mail", "notExistentErrorCode",
			        "common.form.profile.field.mail.orgexists");
		}
		User newUser = null;
		try {
			newUser = UserLocalServiceUtil.getUserByEmailAddress(PortalUtil
			        .getDefaultCompanyId(), newMail.toLowerCase().trim());
			if (newUser != null) {
				errors.rejectValue("mail", "notExistentErrorCode",
				        "common.form.profile.field.mail.usrexists");
			}
		} catch (final Throwable e) {
		}
	}
	if (form.getPass1() != null && form.getPass2() != null) {
		if (!form.getPass1().equals(form.getPass2())) {
			errors.rejectValue("pass1", "notExistentErrorCode",
			        "common.form.profile.field.pass1.match");
			errors.rejectValue("pass2", "notExistentErrorCode",
			        "common.form.profile.field.pass1.match");
			form.setPass1("");
			form.setPass2("");
		}
	}

}
 
开发者ID:fraunhoferfokus,项目名称:particity,代码行数:42,代码来源:ProfileFormValidator.java

示例5: writeOrganisations

import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
private void writeOrganisations(List<OrganisationType> organisations) {
	de.particity.util.PersistentLog.Log log = PersistentLog.getInstance().addLog(LOG_ORGANISATIONS);
	try {
		int size = AHOrgLocalServiceUtil.getAHOrgsCount();
		List<AHOrg> list = null;
		AHOrg data = null;
		OrganisationType type = null;
		for (int i = 0; i<size;i+=10) {
			list = AHOrgLocalServiceUtil.getAHOrgs(i, i+10);
			if (list != null) {
				for (int j=0; j<list.size(); j++) {
					data= list.get(j);
					type = new OrganisationType();
					type.setUserlist(data.getUserlist());
					type.setUpdated(data.getUpdated());
					type.setStatus(E_OrgStatus.findByValue(data.getStatus()).name());
					type.setOwner(data.getOwner());
					type.setOrgId(data.getOrgId());
					type.setName(data.getName());
					DLFileEntry logoFile = getFileFromPath(data.getLogoLocation());
					type.setLogo(getFileContent(logoFile));
					if (logoFile != null)
						type.setLogoFilename(logoFile.getName());
					type.setLegalStatus(data.getLegalStatus());
					type.setHolder(data.getHolder());
					type.setDescription(data.getDescription());
					type.setCreated(data.getCreated());
					type.setAddress(getAddressType(data.getAddressId()));
					type.setContact(getContactType(data.getContactId()));
					User lrUser = UserLocalServiceUtil.getUserByEmailAddress(m_numCompanyId, data.getOwner());
					if (lrUser != null) {
						type.setLoginPassword(lrUser.getPassword());
					}
					organisations.add(type);
					log.log(data.getName());
				}
			}
		}
	} catch (Throwable t) {
		log.err(t.getMessage());
		m_objLog.error("Error on organisation export",t);
	}
}
 
开发者ID:fraunhoferfokus,项目名称:particity,代码行数:44,代码来源:ExportWriter.java

示例6: createPortalUser

import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
/**
 * Creates a new portal user
 *
 * @param firstName the first name
 * @param lastName the last name
 * @param mail the email address
 * @param companyId the company id
 * @param locale the user's locale
 * @return the user object
 */
public static User createPortalUser(final String firstName,
        final String lastName, final String mail, final long companyId, final long groupId,
        final Locale locale, boolean sendMail, String password, boolean isAdmin, E_Role defaultRole) {

	User user = null;
	try {
		if (defaultRole == null)
			defaultRole = E_Role.ORG;
		final Role defRole = checkRole(0, companyId, defaultRole);

		try {
			user = UserLocalServiceUtil.getUserByEmailAddress(companyId,
			        mail);
		} catch (final Throwable t) {
		}
		

		if (user == null) {
			long[] userGroups = new long[1];
			Group guestSite = GroupLocalServiceUtil.getGroup(companyId, GroupConstants.GUEST);
			if (guestSite != null) {
				userGroups = new long[2];
				userGroups[1] = guestSite.getGroupId();
			}
			userGroups[0] = groupId;
			//long[] userGroups = new long[]{groupId, guestSite.getGroupId()};
			
			long[] roles = new long[2];
			roles[0] = defRole.getRoleId();
			
			if (isAdmin) {
				final Role adminRole = checkRole(0, companyId,
				        RoleConstants.ADMINISTRATOR, RoleConstants.TYPE_REGULAR);
				roles[0] = adminRole.getRoleId();
			}
			
			final Role memberRole = checkRole(0, companyId,
			        RoleConstants.SITE_MEMBER, RoleConstants.TYPE_SITE);
			roles[1] = memberRole.getRoleId();
			
			user = UserLocalServiceUtil.addUser(0, companyId, password == null, password,
			        password,
			        true, null, mail, 0L, "", locale, firstName, "",
			        lastName,
			        0, 0, false, 0, 1, 1970, "", userGroups, null,
			        roles, null, sendMail,
			        new ServiceContext());
		}

	} catch (final Exception e) {
		m_objLog.error(e);
	}
	return user;
}
 
开发者ID:fraunhoferfokus,项目名称:particity,代码行数:65,代码来源:CustomPortalServiceHandler.java

示例7: redirecionaParaUfOuAtual

import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
private void redirecionaParaUfOuAtual(ActionRequest request, ActionResponse response, String login) throws IOException {

		ThemeDisplay td = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
		String currentUrl = obtemUrlAtual(td);
		if (currentUrl == null)
			return;

		try {
			Company company = PortalUtil.getCompany(request);

			if (!isComunidadeEDemocracia(response, currentUrl, company)) {
				response.sendRedirect(currentUrl);
				return;
			}

			User user = UserLocalServiceUtil.getUserByEmailAddress(company.getCompanyId(), login);

			if (!possuiEnderecoNoBrasil(response, user)) {
				redirecionaParaEscolhaUf(response, td, currentUrl, company);
			} else {

				String saveLastPath = PropsUtil.get(PropsKeys.AUTH_FORWARD_BY_LAST_PATH);
				boolean saveLastPathEnabled = saveLastPath != null ? Boolean.parseBoolean(saveLastPath) : false;
				// Habilitado redirecionamento depois do login para última tela
				// visitada
				if (saveLastPathEnabled) {
					String lastPath = getLastPath(request);
					if (Validator.isNotNull(lastPath)) {
						response.sendRedirect(lastPath);
					} else {
						response.sendRedirect(currentUrl);
					}
				} else {
					response.sendRedirect(currentUrl);
				}

			}

		} catch (Exception e) {
			// Erro. Vai para a página atual mesmo
			response.sendRedirect(currentUrl);
		}
	}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:44,代码来源:LoginPortlet.java

示例8: getUser

import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
protected User getUser(HttpServletRequest request, long companyId)
	throws PortalException, SystemException {

	HttpSession session = request.getSession();

	String emailAddress = GetterUtil.getString(
		session.getAttribute("GOOGLE_USER_EMAIL_ADDRESS"));

	if (Validator.isNull(emailAddress)) {
		return null;
	}

	session.removeAttribute("GOOGLE_USER_EMAIL_ADDRESS");

	User user = UserLocalServiceUtil.getUserByEmailAddress(
		companyId, emailAddress);

	return user;
}
 
开发者ID:sergiogonzalez,项目名称:google-login-hook,代码行数:20,代码来源:GoogleAutoLogin.java


注:本文中的com.liferay.portal.service.UserLocalServiceUtil.getUserByEmailAddress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。