Package org.exoplatform.services.organization

Examples of org.exoplatform.services.organization.UserHandler


    public void saveUserProfile(UserProfile profile, boolean broadcast) throws Exception {
        // We need to check if userProfile exists, because organization API is limited and it doesn't have separate methods for
        // "creation" and for "update" of user profile :/

        String username = profile.getUserName();
        UserHandler userHandler = this.orgService.getUserHandler();
        //This is temporary because disabled user feature is not implemented
        //userHandler.findUserByName(username, true)
        User user = userHandler.findUserByName(username);
        if(user == null) {
            throw new InvalidNameException("User " + username + " not exists");
        }

        boolean isNew = true;
View Full Code Here


    }

    public Collection findUserProfiles() throws Exception {
        List<UserProfile> profiles = new LinkedList<UserProfile>();

        UserHandler userHandler = this.orgService.getUserHandler();
        //This should find enabled user
        ListAccess<User> users = userHandler.findAllUsers();
        int size = users.getSize();
        for(User u : users.load(0, size)) {
            UserProfile profile = this.getProfile(u.getUserName());
            if(profile != null) {
                profiles.add(profile);
View Full Code Here

        }

        private MembershipUser toMembershipUser(Membership membership) throws Exception {
            OrganizationService service = getApplicationComponent(OrganizationService.class);
            String userName = membership.getUserName();
            UserHandler handler = service.getUserHandler();
            User user = handler.findUserByName(userName);
            if (user == null)
                return null;
            return new MembershipUser(user, membership.getMembershipType(), membership.getId());
        }
View Full Code Here

    public static class SubscribeActionListener extends EventListener<UIRegisterForm> {
        @Override
        public void execute(Event<UIRegisterForm> event) throws Exception {
            UIRegisterForm registerForm = event.getSource();
            OrganizationService orgService = registerForm.getApplicationComponent(OrganizationService.class);
            UserHandler userHandler = orgService.getUserHandler();
            WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
            UIRegisterInputSet registerInput = registerForm.getChild(UIRegisterInputSet.class);

            if (registerInput.save(userHandler, context)) {
                // TODO: Add Account Activating feature
View Full Code Here

                        ApplicationMessage.INFO));
            }
        }

        private boolean usernameIsUsed(String username, OrganizationService orgService) {
            UserHandler userHandler = orgService.getUserHandler();
            try {
                if (userHandler.findUserByName(username) != null) {
                    return true;
                }
            } catch (Exception ex) {
                log.error(ex.getMessage(), ex);
            }
View Full Code Here

    public static class SubscribeActionListener extends EventListener<UIRegisterForm> {
        @Override
        public void execute(Event<UIRegisterForm> event) throws Exception {
            UIRegisterForm registerForm = event.getSource();
            OrganizationService orgService = registerForm.getApplicationComponent(OrganizationService.class);
            UserHandler userHandler = orgService.getUserHandler();
            WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
            UIRegisterInputSet registerInput = registerForm.getChild(UIRegisterInputSet.class);

            if (registerInput.save(userHandler, context)) {
                // TODO: Add Account Activating feature
View Full Code Here

                        ApplicationMessage.INFO));
            }
        }

        private boolean usernameIsUsed(String username, OrganizationService orgService) {
            UserHandler userHandler = orgService.getUserHandler();
            try {
                if (userHandler.findUserByName(username, UserStatus.ANY) != null) {
                    return true;
                }
            } catch (Exception ex) {
                log.error(ex.getMessage(), ex);
            }
View Full Code Here

            String username = ((NameCallback) callbacks[0]).getName();
            if (username != null) {
                OrganizationService service = (OrganizationService) getContainer().getComponentInstanceOfType(
                        OrganizationService.class);

                UserHandler uHandler = service.getUserHandler();
                User user = uHandler.findUserByName(username, UserStatus.ANY);

                if (user == null) {
                    log.debug("user {0} doesn't exists. FilterDisabledLoginModule will be ignored.", username);
                } else if (user instanceof UserImpl && !((UserImpl) user).isEnabled()) {
                    HttpServletRequest request = getCurrentHttpServletRequest();
View Full Code Here

      begin(orgService);
      boolean success;
      try
      {
         UserHandler userHandler = orgService.getUserHandler();
         if (passwordContext != null && userHandler instanceof ExtendedUserHandler)
         {
            PasswordEncrypter pe = new DigestPasswordEncrypter(username, passwordContext);
            success = ((ExtendedUserHandler)userHandler).authenticate(username, password, pe);
         }
         else
         {
            success = userHandler.authenticate(username, password);
         }
         // No exception occurred
         lastExceptionOnValidateUser.remove();
      }
      catch (DisabledUserException e)
View Full Code Here

        this.codec = codecInitializer.getCodec();
    }

    @Override
    public User findUserByOAuthProviderUsername(OAuthProviderType oauthProviderType, String oauthProviderUsername) {
        UserHandler userHandler = orgService.getUserHandler();

        // TODO: Ugly, but it's used due to OrganizationService API limitations because it doesn't allow to find user by unique userProfile attribute
        try {
            Method m = userHandler.getClass().getDeclaredMethod("findUserByUniqueAttribute", String.class, String.class);
            return (User)m.invoke(userHandler, oauthProviderType.getUserNameAttrName(), oauthProviderUsername);
        } catch (NoSuchMethodException e) {
            String error = "Method findUserByUniqueAttribute(String, String) is not available on userHandler object " + userHandler +
                    "of class " + userHandler.getClass();
            log.error(error);
            throw new OAuthException(OAuthExceptionCode.PERSISTENCE_ERROR, error, e);
        } catch (Exception e) {
            throw new OAuthException(OAuthExceptionCode.PERSISTENCE_ERROR, e);
        }
View Full Code Here

TOP

Related Classes of org.exoplatform.services.organization.UserHandler

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.