Package org.exoplatform.services.organization

Examples of org.exoplatform.services.organization.UserHandler


            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, false);

                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


  

   public void testGetLastExceptionOnValidateUser() throws Exception
   {
      assertNotNull(orgService);
      UserHandler uh = orgService.getUserHandler();
      User user = uh.createUserInstance("testGetLastExceptionOnValidateUser");
      user.setPassword("foo");
      assertNotNull(authenticator);
      assertTrue(authenticator instanceof OrganizationAuthenticatorImpl);
      Credential[] cred = new Credential[]{new UsernameCredential("testGetLastExceptionOnValidateUser"), new PasswordCredential("foo")};
      String userId = authenticator.validateUser(cred);
      assertEquals("testGetLastExceptionOnValidateUser", userId);
      assertNull(authenticator.getLastExceptionOnValidateUser());
      assertNull(authenticator.getLastExceptionOnValidateUser());
      uh.setEnabled("testGetLastExceptionOnValidateUser", false, false);
      try
      {
         authenticator.validateUser(cred);
         fail("a LoginException was expected");
      }
      catch (LoginException e)
      {
         // expected
      }
      assertTrue(authenticator.getLastExceptionOnValidateUser() instanceof DisabledUserException);
      assertNull(authenticator.getLastExceptionOnValidateUser());
      uh.setEnabled("testGetLastExceptionOnValidateUser", true, false);
      userId = authenticator.validateUser(cred);
      assertEquals("testGetLastExceptionOnValidateUser", userId);
      assertNull(authenticator.getLastExceptionOnValidateUser());
      assertNull(authenticator.getLastExceptionOnValidateUser());
   }
View Full Code Here

    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();
        User user = userHandler.findUserByName(username, UserStatus.ANY);
        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

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.