Search in sources :

Example 1 with NoSuchOrganizationException

use of com.liferay.portal.NoSuchOrganizationException in project liferay-ide by liferay.

the class UserLocalServiceImpl method validate.

protected void validate(long companyId, long userId, boolean autoPassword, String password1, String password2, boolean autoScreenName, String screenName, String emailAddress, String openId, String firstName, String middleName, String lastName, long[] organizationIds) throws PortalException, SystemException {
    validateCompanyMaxUsers(companyId);
    if (!autoScreenName) {
        validateScreenName(companyId, userId, screenName);
    }
    if (!autoPassword) {
        PasswordPolicy passwordPolicy = passwordPolicyLocalService.getDefaultPasswordPolicy(companyId);
        PwdToolkitUtil.validate(companyId, 0, password1, password2, passwordPolicy);
    }
    validateEmailAddress(companyId, emailAddress);
    if (Validator.isNotNull(emailAddress)) {
        User user = userPersistence.fetchByC_EA(companyId, emailAddress);
        if ((user != null) && (user.getUserId() != userId)) {
            throw new DuplicateUserEmailAddressException("{userId=" + userId + "}");
        }
    }
    validateOpenId(companyId, userId, openId);
    validateFullName(companyId, firstName, middleName, lastName);
    if (organizationIds != null) {
        for (long organizationId : organizationIds) {
            Organization organization = organizationPersistence.fetchByPrimaryKey(organizationId);
            if (organization == null) {
                throw new NoSuchOrganizationException("{organizationId=" + organizationId + "}");
            }
        }
    }
}
Also used : User(com.liferay.portal.model.User) Organization(com.liferay.portal.model.Organization) DuplicateUserEmailAddressException(com.liferay.portal.DuplicateUserEmailAddressException) PasswordPolicy(com.liferay.portal.model.PasswordPolicy) NoSuchOrganizationException(com.liferay.portal.NoSuchOrganizationException)

Aggregations

DuplicateUserEmailAddressException (com.liferay.portal.DuplicateUserEmailAddressException)1 NoSuchOrganizationException (com.liferay.portal.NoSuchOrganizationException)1 Organization (com.liferay.portal.model.Organization)1 PasswordPolicy (com.liferay.portal.model.PasswordPolicy)1 User (com.liferay.portal.model.User)1