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

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


      }
    }

    // check if user already exists

    User u = null;

    try {
      u = userManager.getUserByLogin(user);
    } catch (Exception e) {
      log.error("Error retrieving Userdata : " + e.getMessage());
    }
   
    // Attributes to retrieve from ldap to either create or update the user
    List<String> attributes = new ArrayList<String>();
    attributes.add(ldap_user_attr_lastname); // Lastname
    attributes.add(ldap_user_attr_firstname); // Firstname
    attributes.add(ldap_user_attr_mail);// mail
    attributes.add(ldap_user_attr_street); // Street
    attributes.add(ldap_user_attr_additional_name); // Additional name
    attributes.add(ldap_user_attr_fax); // Fax
    attributes.add(ldap_user_attr_zip); // ZIP
    attributes.add(ldap_user_attr_country); // Country
    attributes.add(ldap_user_attr_town); // Town
    attributes.add(ldap_user_attr_phone); // Phone
    attributes.add(ldap_user_attr_timezone); // timezone
    if (ldap_user_picture_uri != null) {
      attributes.add(ldap_user_picture_uri); //picture uri
    }
   
    HashMap<String, String> ldapAttrs = new HashMap<String, String>();
    ldapAttrs.put("lastnameAttr", ldap_user_attr_lastname);
    ldapAttrs.put("firstnameAttr", ldap_user_attr_firstname);
    ldapAttrs.put("mailAttr", ldap_user_attr_mail);
    ldapAttrs.put("streetAttr", ldap_user_attr_street);
    ldapAttrs.put("additionalNameAttr", ldap_user_attr_additional_name);
    ldapAttrs.put("faxAttr", ldap_user_attr_fax);
    ldapAttrs.put("zipAttr", ldap_user_attr_zip);
    ldapAttrs.put("countryAttr", ldap_user_attr_country);
    ldapAttrs.put("townAttr", ldap_user_attr_town);
    ldapAttrs.put("phoneAttr", ldap_user_attr_phone);
    ldapAttrs.put("timezoneAttr", ldap_user_attr_timezone);
    if (ldap_user_picture_uri != null) {
      ldapAttrs.put("pictureUri", ldap_user_picture_uri);
    }

    Vector<HashMap<String, String>> result = lAuth.getData(
        ldap_search_scope, ldap_search_filter, attributes);

    if (result == null || result.size() < 1) {
      log.error("Error on Ldap request - no result for user " + user);
      return new Long(-10);
    }
   
    if (result.size() > 1) {
      log.error("Error on Ldap request - more than one result for user " + user);
      return null;
    }
   
    HashMap<String, String> userData = result.get(0);


    // User not existant in local database -> take over data for referential
    // integrity
    if (u == null) {
      log.debug("user doesnt exist local -> create new");

      try {
        // Create User with LdapData
        Long userid;
        if (ldap_sync_passwd_to_om) {
          Random r = new Random();
          String token = UUID.randomUUID().toString() + Long.toString(Math.abs(r.nextLong()), 36);
          log.debug("Synching Ldap user to OM DB with RANDOM password: " + token);
          userid = createUserFromLdapData(userData, token, user, ldapAttrs);
        } else {
          log.debug("Synching Ldap user to OM DB with password");
          userid = createUserFromLdapData(userData, passwd, user, ldapAttrs);
        }
        log.debug("New User ID : " + userid);

        // If invoked via SOAP this is NULL
        if (currentClient != null) {
          currentClient.setUser_id(userid);
          SessionVariablesUtil.setUserId(client, userid);
        }

        // Update Session
        Boolean bool = sessiondataDao.updateUser(SID, userid);

        if (bool == null) {
          // Exception
          log.error("Error on Updating Session");
          return new Long(-1);
        } else if (!bool) {
          // invalid Session-Object
          log.error("Invalid Session Object");
          return new Long(-35);
        }

        // Return UserObject
        User u2 = userManager.getUserById(userid);

        if (u2 == null) {
          return new Long(-1);
        }

        u2.setType(Type.ldap);

        // initialize lazy collection
        userManager.refreshUserObject(u2);

        log.debug("getUserbyId : " + userid + " : " + u2.getLogin());

        return u2;
      } catch (Exception e) {
        log.error("Error on Working Userdata : ", e);
        return new Long(-1);
View Full Code Here


          "", //userSearchs
          false, //showContactData
          true //showContactDataToContacts
          );
     
      User user = usersDao.get(newUserId);
      user.setPictureuri(pictureUri);
      usersDao.update(user, null);

    } catch (Exception e) {
      log.error("Error creating user : " + e.getMessage());
    }
View Full Code Here

   * @param SID
   * @param USER_ID
   * @return - user with SID given
   */
  public User getUser(String SID, int USER_ID) {
    User users = new User();
    Long users_id = sessiondataDao.checkSession(SID);
    long user_level = userManager.getUserLevelByID(users_id);
    if (user_level > 2) {
      users = usersDao.get(new Long(USER_ID));
    } else {
      users.setFirstname("No rights to do this");
    }
    return users;
  }
View Full Code Here

    return -1L;
  }

  public User loginWicket(String SID, String wicketSID, Long wicketroomid) {
    Long userId = sessiondataDao.checkSession(wicketSID);
    User u = userId == null ? null : usersDao.get(userId);
    if (u != null) {
      IConnection current = Red5.getConnectionLocal();
      String streamId = current.getClient().getId();
      Client currentClient = sessionManager.getClientByStreamId(streamId, null);
     
      if (!u.getOrganisation_users().isEmpty()) {
        u.setSessionData(sessiondataDao.getSessionByHash(wicketSID));
        currentClient.setUser_id(u.getUser_id());
        currentClient.setRoom_id(wicketroomid);
        SessionVariablesUtil.setUserId(current.getClient(), u.getUser_id());
     
        currentClient.setUsername(u.getLogin());
        currentClient.setFirstname(u.getFirstname());
        currentClient.setLastname(u.getLastname());
        currentClient.setPicture_uri(u.getPictureuri());
        sessionManager.updateClientByStreamId(streamId, currentClient, false, null);
       
        scopeApplicationAdapter.syncMessageToCurrentScope("roomConnect", currentClient, false);
       
        return u;
View Full Code Here

     * @param message
     * @param subject
   * @throws Exception
   */
  private void sendInvitionLink(Appointment a, MeetingMember mm, MessageType type, boolean ical) throws Exception  {
    User owner = a.getOwner();
    String invitorName = owner.getFirstname() + " " + owner.getLastname();
    Long langId = mm.getUser().getLanguage_id();
    TimeZone tz = timezoneUtil.getTimeZone(mm.getUser());
    String subject = null;
    String message = null;
    switch (type) {
View Full Code Here

          if (!Strings.isEmpty(userObject.getExternalUserId())) {
            // If so we need to check that we create this user in
            // OpenMeetings and update its record

            User user = userManager.getUserByExternalIdAndType(
                userObject.getExternalUserId(),
                userObject.getExternalUserType());

            if (user == null) {
              String iCalTz = configurationDao.getConfValue("default.timezone", String.class, "");

              long userId = userManager
                  .addUserWithExternalKey(1, 0, 0,
                      userObject.getFirstname(),
                      userObject.getUsername(),
                      userObject.getLastname(), 1L,
                      true, "", // password is empty by default
                      null, null, "",
                      userObject.getExternalUserId(),
                      userObject.getExternalUserType(),
                      true, userObject.getEmail(),
                      iCalTz,
                      userObject.getPictureUrl());

              currentClient.setUser_id(userId);
              SessionVariablesUtil.setUserId(current.getClient(), userId);
            } else {
              user.setPictureuri(userObject.getPictureUrl());

              userManager.updateUser(user);

              currentClient.setUser_id(user.getUser_id());
              SessionVariablesUtil.setUserId(current.getClient(), user.getUser_id());
            }
          }

          log.debug("userObject.getExternalUserId() -2- " + currentClient.getUser_id());
View Full Code Here

    sendInvitionLink(mm.getInvitation(), type, subject, message, ical);
  }
 
  public void sendInvitionLink(Invitation i, MessageType type, String subject, String message, boolean ical) throws Exception {
    String invitation_link = LinkHelper.getInvitationLink(configDao.getBaseUrl(), i);
    User owner = i.getInvitedBy();
   
    String invitorName = owner.getFirstname() + " " + owner.getLastname();
    boolean isCanceled = (type==MessageType.Cancel);
    String template = InvitationTemplate.getEmail(i.getInvitee().getLanguage_id(), invitorName, message, invitation_link, isCanceled);
    String email = i.getInvitee().getAdresses().getEmail();
    String replyToEmail = owner.getAdresses().getEmail();
   
    if (ical) {
      String username = i.getInvitee().getLogin();
      boolean isOwner = owner.getUser_id() == i.getInvitee().getUser_id();
      IcalHandler handler = new IcalHandler(MessageType.Cancel == type ? IcalHandler.ICAL_METHOD_CANCEL : IcalHandler.ICAL_METHOD_REQUEST);

      HashMap<String, String> attendeeList = handler.getAttendeeData(email, username, isOwner);

      Vector<HashMap<String, String>> atts = new Vector<HashMap<String, String>>();
      atts.add(attendeeList);

      // Defining Organizer

      HashMap<String, String> organizerAttendee = handler.getAttendeeData(email, username, isOwner);
      organizerAttendee = handler.getAttendeeData(replyToEmail, owner.getLogin(), isOwner);

      Appointment a = i.getAppointment();
      // Create ICal Message
      //FIXME should be checked to generate valid time
      String meetingId = handler.addNewMeeting(a.getStart(), a.getEnd(),
View Full Code Here

    try {
      sessiondataDao.updateUserWithoutSession(SID, -1L);
     
      Long defaultRpcUserid = configurationDao.getConfValue(
          "default.rpc.userid", Long.class, "-1");
      User defaultRpcUser = userManager.getUserById(defaultRpcUserid);
     
      User user = new User();
      user.setOrganisation_users(defaultRpcUser.getOrganisation_users());
     
      return user;
     
    } catch (Exception err) {
      log.error("[markSessionAsLogedIn]", err);
View Full Code Here

  private static final long serialVersionUID = 1L;
  private final static int PAGE_SIZE = 10;
  private Map<String, User> newContacts = new Hashtable<String, User>();
 
  public static User getUser(String value) {
    User u = null;
    //FIXME refactor this
    String email = null;
    String fName = null;
    String lName = null;
    int idx = value.indexOf('<');
View Full Code Here

    return id;
  }

  @Override
  public void query(String term, int page, Response<User> response) {
    User c = getUser(term);
    if (c != null) {
      response.add(c);
    }
    UserDao dao = getBean(UserDao.class);
    response.addAll(dao.get(term, page * PAGE_SIZE, PAGE_SIZE, null, getUserId()));
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.