Package org.apache.openmeetings.db.entity.user

Examples of org.apache.openmeetings.db.entity.user.User


    try {
      Long users_id = sessiondataDao.checkSession(SID);

      if (AuthLevelUtil.hasAdminLevel(userDao.getRights(users_id))) {

        User testUser = userDao.getExternalUser(externalUserId, externalUserType);

        if (testUser != null) {
          throw new Exception("User does already exist!");
        }

        // This will send no email to the users
        Long user_id = userManagement.registerUserNoEmail(username,
            userpass, lastname, firstname, email, new Date(),
            street, additionalname, fax, zip, states_id, town,
            language_id, "", false, true, // generate SIP Data if the config is enabled
            jNameTimeZone);

        if (user_id == null || user_id < 0) {
          return user_id;
        }

        User user = userDao.get(user_id);

        // activate the User
        user.getRights().add(Right.Login);
        user.setUpdatetime(new Date());
        user.setExternalUserId(externalUserId);
        user.setExternalUserType(externalUserType);

        userDao.update(user, users_id);

        return user_id;
View Full Code Here


    try {
      Long users_id = sessiondataDao.checkSession(SID);

      if (AuthLevelUtil.hasAdminLevel(userDao.getRights(users_id))) {

        User userExternal = userDao.getExternalUser(externalUserId, externalUserType);

        Long userId = userExternal.getUser_id();

        // Setting user deleted
        userDao.deleteUserID(userId);

        return userId;
View Full Code Here

      Long organisation_id, Long insertedby) {
    try {
      Long users_id = sessiondataDao.checkSession(SID);
      if (AuthLevelUtil.hasWebServiceLevel(userDao.getRights(users_id))) {
        if (!orgUserDao.isUserInOrganization(organisation_id, user_id)) {
          User u = userDao.get(user_id);
          u.getOrganisation_users().add(new Organisation_Users(orgDao.get(organisation_id)));
          userDao.update(u, users_id);
        }
        return user_id;
      } else {
        return new Long(-26);
View Full Code Here

    Organisation o = new Organisation();
    o.setName("default");
    o = orgDao.update(o, null);
    assertNotNull("Id of organisation created should not be null", o.getOrganisation_id());

    User us = usersDao.get(1L);
    assertNotNull("User should exist", us);
   
    assertNotNull("Organisation User list should exist", us.getOrganisation_users());
    us.getOrganisation_users().add(new Organisation_Users(o));
    us = usersDao.update(us, null);

    log.error(us.getLastname());
    log.error(us.getAdresses().getTown());
  }
View Full Code Here

        .addUserToOrganisation(new Long(1), organisation_id,
            new Long(1));

    log.error("new organisation_user: " + organisation_usersid);

    User us = usersDao.get(new Long(1));

    log.error(us.getLastname());
    log.error(us.getAdresses().getTown());

    /*
     * for (Iterator it = us.getAdresses().getEmails().iterator();
     * it.hasNext();){ Adresses_Emails addrMails = (Adresses_Emails)
     * it.next(); log.error(addrMails.getMail().getEmail()); }
View Full Code Here

    assertNotNull("Cann't add appointment", id);
    return ap;
  }

  public User createUser(int rnd) throws Exception {
    User u = new User();
    // add user
    u.setFirstname("firstname" + rnd);
    u.setLastname("lastname" + rnd);
    u.setLogin("login" + rnd);
    u.updatePassword(configurationDao, "pass" + rnd);
    u.setLanguage_id(1L);
    Long user_id = userManager.addUser(u);
    assertTrue("Cann't add user", user_id > 0);
    u = userManager.getUserByIdAndDeleted(user_id);
    assertNotNull("User should not be null", u);
    return u;
View Full Code Here

    cfg.ical_timeZone = timeZone;
    importInitvalues.loadAll(cfg, false);
  }

  public User createUserContact(int rnd, Long ownerId) {
    User user = userDao.getContact("email" + rnd, "firstname" + rnd, "lastname" + rnd, ownerId);
    user = userDao.update(user, ownerId);
    assertNotNull("Cann't add user", user);
    return user;
  }
View Full Code Here

    return null//unreachable
  }
 
  @Test
  public void getUsersByOrganisationId() {
    User u = getValidUser();
    Long orgId = u.getOrganisation_users().get(0).getOrganisation().getOrganisation_id();
    List<User> ul = orgManagement.getUsersByOrganisationId(orgId, 0, 9999, "login", true);
    assertTrue("Default Organisation should contain at least 1 user: " + ul.size(), ul.size() > 0);
   
    Organisation_Users ou = orgManagement.getOrganisation_UserByUserAndOrganisation(u.getUser_id(), orgId);
    assertNotNull("Unable to found [organisation, user] pair - [" + orgId + "," + u.getUser_id() + "]", ou);
  }
View Full Code Here

    List<User> users = adminUserDao.getAllUsers();
    assertNotNull("User list should not be null ", users);
    assertFalse("User list should not be empty ", users.isEmpty());
   
    Random random = new Random();
    User contact = createUserContact(random.nextInt(), getUserId());
    String email = contact.getAdresses().getEmail();
    List<User> l = adminUserDao.get(email);
    // check that contact is visible for admin
    assertNotNull("Contact list should not be null for admin ", l);
    assertFalse("Contact list should not be empty for admin ", l.isEmpty());
   
    // check that contact is visible for owner
    l = usersDao.get(email, getUserId());
    assertTrue("Contact list should not be empty for owner ", !l.isEmpty());   
    //delete contact
    adminUserDao.delete(contact, getUserId());
    l = adminUserDao.get(email);
    assertTrue("Contact list should be empty after deletion", l.isEmpty());

    User u = createUser(random.nextInt());
    User u1 = createUser(random.nextInt());
    contact = createUserContact(random.nextInt(), u.getUser_id());
    email = contact.getAdresses().getEmail();
    // check that contact is not visible for user that is not owner of this contact
    l = usersDao.get(email, u1.getUser_id());
    assertTrue("Contact list should be empty for another user", l.isEmpty());
    //delete contact
    adminUserDao.delete(contact, u.getUser_id());
    l = adminUserDao.get(email);
    assertTrue("Contact list should be empty after deletion", l.isEmpty());
View Full Code Here

  @Test
  public void testTestLogin(){
    Sessiondata sessionData = mService.getsessiondata();
   
    User us = (User) userManager.loginUser(sessionData.getSession_id(), username, userpass, null, null, false);
   
    assertNotNull("User is unable to login", us);
   
    //mService.getLanguageById(1);
   
View Full Code Here

TOP

Related Classes of org.apache.openmeetings.db.entity.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.