Package com.agiletec.aps.system.services.user

Examples of com.agiletec.aps.system.services.user.User


      closeConnection(conn);
    }
  }
 
  public void addUser(String username, String nome, String cognome, String email, boolean cat1, boolean cat2) throws ApsSystemException {
    User user = new User();
    user.setUsername(username);
    user.setPassword(username);
    user.setDisabled(false);
    this._userManager.addUser(user);
    this.addProfile(username, nome, cognome, email, cat1, cat2);
  }
View Full Code Here


    RequestContext reqCtx = this.getRequestContext();

    Role role = new Role();
    role.setName("testRole");

    User user =  new User();
    user.addAutority(role);

    reqCtx.getRequest().getSession().setAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER, user);

    Page page = new Page();
    page.setCode("login");
View Full Code Here

  public void testServiceFailure() throws ApsSystemException {
    RequestContext reqCtx = this.getRequestContext();

    Role role = new Role();
    role.setName("testRole");
    User user =  new User();
    user.addAutority(role);
    reqCtx.getRequest().getSession().setAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER, user);

    Page page = new Page();
    page.setCode("login");
    page.setGroup("free");
View Full Code Here

                this._log.trace("jpcasclient: new user: " + user.getUsername());
              }
            } else {
//                      req.setAttribute("wrongAccountCredential", new Boolean(true));
              /* create user on the fly */
              user = new User();
              ((User) user).setUsername(username);
              ((User) user).setPassword(CasClientPluginSystemCostants.JPCAS_RUNTIME_USER);
              ((User) user).setLastAccess(new Date());
              /* put in the session */
              session.setAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER, user);
View Full Code Here

  }

  public void testDeleteAOPAvatar() throws Throwable {
    this.setAvatarStyle(AvatarConfig.STYLE_LOCAL);
   
    User user = new User();
    String username = "jpavatarTestUser".toLowerCase();
    user.setUsername(username);
    user.setPassword(username);
    _userManager.addUser(user);
    assertNotNull(_userManager.getUser(username));
    File file = new File("target/test/entando_logo.jpg");
    this._avatarManager.saveAvatar(username, file, "entando_logo.jpg");
    String filename = this._avatarManager.getAvatarUrl(username);
View Full Code Here

  public void testActivate() throws Throwable {
    String username = "username_test";
    String token = "token_test";
    try {
      //    prepare
      User user = new User();
      user.setDisabled(true);
      user.setUsername(username);
      user.setPassword("password");
      _userManager.addUser(user);
      _userRegDAO.addActivationToken(username, token, new Date(), IUserRegDAO.ACTIVATION_TOKEN_TYPE);
           
      this.initAction("/do/jpuserreg/UserReg", "activate");
      this.addParameter("token", token);
      this.addParameter("password", "012345678");
      this.addParameter("passwordConfirm", "012345678");
      String result = this.executeAction();
      assertEquals("success", result);
      user = (User) _userManager.getUser(username);
      assertNotNull(user);
      assertFalse(user.isDisabled());
    } finally {
      //    clean
      _userManager.removeUser(username);
    }
  }
View Full Code Here

    String username = "username_test";
    String token = "token_test";
    String tokenFake = "12345678";
    try {
      //    prepare
      User user = new User();
      user.setDisabled(true);
      user.setUsername(username);
      user.setPassword("password");
      _userManager.addUser(user);
      _userRegDAO.addActivationToken(username, token, new Date(), IUserRegDAO.ACTIVATION_TOKEN_TYPE);
           
      this.initAction("/do/jpuserreg/UserReg", "initActivation");
      this.addParameter("token",  tokenFake);
      String result = this.executeAction();
      assertEquals("activationError", result);
      user = (User) _userManager.getUser(username);
      assertNotNull(user);
      assertTrue(user.isDisabled());
    } finally {
      //    clean
      _userManager.removeUser(username);
    }
  }
View Full Code Here

  //  to verify config a valid email addess in email field
  public void testRegAccount() throws Throwable {
    String username = "username_test";
    try {
      insertTestUserProfile(username);
      User user = (User) _userManager.getUser(username);
      assertNotNull(user);
      assertNotNull(user.getProfile());
     
      String token = this._testHelper.getTokenFromUsername(username);
      assertNotNull(token);
     
      this._userManager.removeUser(username);
View Full Code Here

 
  public void testActivateUser() throws Exception {
    String username = "username_test";
    String token = "token_test";
    try {
      User user = new User();
      user.setDisabled(true);
      user.setUsername(username);
      user.setPassword("password");
      _userManager.addUser(user);
      _userRegDAO.addActivationToken(username, token, new Date(), IUserRegDAO.ACTIVATION_TOKEN_TYPE);
      _userRegManager.activateUser(username, "password", token);
      user = (User) _userManager.getUser(username);
      assertNotNull(user);
      assertNotNull(user.getAuthorities());
      List<IApsAuthority> groups = ((IApsAuthorityManager) this._groupManager).getAuthorizationsByUser(user);
      List<IApsAuthority> roles = ((IApsAuthorityManager) this._roleManager).getAuthorizationsByUser(user);
      assertEquals(2, groups.size());
      assertEquals(2, roles.size());
      assertFalse(user.isDisabled());
    } finally {
      _userManager.removeUser(username);
    }
  }
View Full Code Here

 
  public void testReactivateUser() throws Exception {
    String username = "username_test";
    String token = "token_test";
    try {
      User user = new User();
      user.setDisabled(true);
      user.setUsername(username);
      user.setPassword("password");
      _userManager.addUser(user);
      _userRegDAO.addActivationToken(username, token, new Date(), IUserRegDAO.REACTIVATION_RECOVER_TOKEN_TYPE);
      _userRegManager.reactivateUser(username, "password", token);
      user = (User) _userManager.getUser(username);
      assertNotNull(user);
      assertNotNull(user.getAuthorities());
      List<IApsAuthority> groups = ((IApsAuthorityManager) this._groupManager).getAuthorizationsByUser(user);
      List<IApsAuthority> roles = ((IApsAuthorityManager) this._roleManager).getAuthorizationsByUser(user);
      assertEquals(0, groups.size());
      assertEquals(0, roles.size());
      assertFalse(user.isDisabled());
    } finally {
      //    clean
      _userManager.removeUser(username);
    }
  }
View Full Code Here

TOP

Related Classes of com.agiletec.aps.system.services.user.User

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.