Package org.olat.core.id

Examples of org.olat.core.id.Identity


    String feedback = request.getParameter("textarea");
    String errorNr = feedback.substring(0, feedback.indexOf("\n") - 1);
    String username = request.getParameter("username");
    try {
            IdentityManager im = (IdentityManager)CoreSpringFactory.getBean("core.id.IdentityManager");
      Identity ident = im.findIdentityByName(username);
      //if null, user may crashed befor getting a valid session, try with guest user instead
      if (ident == null) ident = im.findIdentityByName("guest");
      Emailer emailer = new Emailer(ident, true);
      LogFile lf = new LogFile();
      Date d = new Date();
View Full Code Here


  private Address[] createAddressesFromIdentities(List<Identity> recipients, MailerResult result) {
    Address[] addresses = null;
    if (recipients != null && recipients.size() > 0) {
      List<Address> validRecipients = new ArrayList<Address>();
      for (int i = 0; i < recipients.size(); i++) {
        Identity identity = recipients.get(i);
        try {
          validRecipients.add(new InternetAddress(identity.getUser().getProperty(UserConstants.EMAIL, null)));
        } catch (AddressException e) {
          result.addFailedIdentites(identity);
        }
      }
      addresses = validRecipients.toArray(new Address[validRecipients.size()]);
View Full Code Here

      //e.g. a worker thread like in Search or UpdateEfficiency worker
      //TODO:pb:check if this was also a problem with IM threads.
      ureq = tld.getHttpServletRequest();
    }
    UserSession usess = null;
    Identity identity = null;
    String remoteIp = null;
    String userAgent = null;
    String referer = null;
    if (ureq != null) {
      usess = UserSession.getUserSessionIfAlreadySet(ureq);
      if (usess != null) {
        identity = usess.getIdentity();
        remoteIp = ureq.getRemoteAddr();
        userAgent = ureq.getHeader("User-Agent");
        referer = ureq.getHeader("Referer");
      }
    }

    StringBuilder sb = new StringBuilder();
    if (!Settings.isDebuging()) {
      sb.append(PREFIX);
      sb.append(category);
      sb.append(SEPARATOR);
      try {
        // Node-Id + Error number e.g. N1-E17
        sb.append("N");
        //FIXME:gs remove access to coordinator: gs accessing coordinator here loads the corespring factory. This means we cannot do unit testing without olat
        // as the first log call will start the whole OLAT stuff.
        sb.append(CoordinatorManager.getCoordinator().getNodeId());
        sb.append("-");
      } catch (Throwable th) {
        //ok
        sb.append(N_A);
      }
       
      sb.append(prefix);
      sb.append(refNum);
      sb.append(SEPARATOR);
      sb.append(callingClass == null ? N_A : callingClass.getPackage().getName());
      sb.append(SEPARATOR);
      sb.append(identity == null ? N_A : identity.getName());
      sb.append(SEPARATOR);
      sb.append(remoteIp == null ? N_A : remoteIp);
      sb.append(SEPARATOR);
      sb.append(referer == null ? N_A : referer);
      sb.append(SEPARATOR);
View Full Code Here

      //e.g. a worker thread like in Search or UpdateEfficiency worker
      //TODO:pb:check if this was also a problem with IM threads.
      ureq = tld.getHttpServletRequest();
    }
    UserSession usess = null;
    Identity identity = null;
    String remoteIp = null;
    String userAgent = null;
    String referer = null;
    if (ureq != null) {
      usess = UserSession.getUserSession(ureq);
      identity = usess.getIdentity();
      remoteIp = ureq.getRemoteAddr();
      userAgent = ureq.getHeader("User-Agent");
      referer = ureq.getHeader("Referer");
    }

    StringBuilder sb = new StringBuilder();
    if (!Settings.isDebuging()) {
      sb.append(PREFIX);
      sb.append(category);
      sb.append(SEPARATOR);
      try {
        // Node-Id + Error number e.g. N1-E17
        sb.append("N");
        //FIXME:gs remove access to coordinator: gs accessing coordinator here loads the corespring factory. This means we cannot do unit testing without olat
        // as the first log call will start the whole OLAT stuff.
        sb.append(CoordinatorManager.getCoordinator().getNodeId());
        sb.append("-");
      } catch (Throwable th) {
        //ok
        sb.append(N_A);
      }
      sb.append(prefix);
      sb.append(refNum);
      sb.append(SEPARATOR);
      sb.append(callingClass == null ? N_A : callingClass.getPackage().getName());
      sb.append(SEPARATOR);
      sb.append(identity == null ? N_A : identity.getName());
      sb.append(SEPARATOR);
      sb.append(remoteIp == null ? N_A : remoteIp);
      sb.append(SEPARATOR);
      sb.append(referer == null ? N_A : referer);
      sb.append(SEPARATOR);
View Full Code Here

      return;
    }
    Boolean usessReplayUrls = (Boolean)ureq.getUserSession().getEntry(REPLAY_URL);
    //param not found in the session
    if(usessReplayUrls == null){
      Identity changeableIdentity = ureq.getIdentity();
      if(changeableIdentity != null){
        //only hit the Database if an identity is found!
        //see also OLAT-2790
        usessReplayUrls = (Boolean) ureq.getUserSession().getGuiPreferences().get(WindowManager.class, REPLAY_URL);
      } else {
View Full Code Here

      if (fdc != null) {
        fdc.setUserSession(usess);
        return fdc;
      }
     
      Identity identity = usess.getIdentity();
      // we need an identity...
      if (identity == null) return null;


      fdc = new VFSDirContext();
View Full Code Here

          ICourse course = CourseFactory.loadCourse(re.getOlatResource());
          CourseNode courseNode = course.getRunStructure().getNode(tokenKey);
          return courseNode.getShortTitle();
        }
        if ("Identity".equals(tokenType)) {
          Identity identity  = ManagerFactory.getManager().loadIdentityByKey(Long.parseLong(tokenKey));
          User user = identity.getUser();
          return user.getProperty(UserConstants.LASTNAME, locale) + " " + user.getProperty(UserConstants.FIRSTNAME, locale) ;
        }
        if ("BusinessGroup".equals(tokenType)) {
          BusinessGroup bg =BusinessGroupManagerImpl.getInstance().loadBusinessGroup(Long.parseLong(tokenKey), true);
          return bg.getName();
View Full Code Here

    MediaResource resource = null;
    FeedManager manager = FeedManager.getInstance();

    if (path.isFeedType()) {
      // Only create feed if modified. Send not modified response else.
      Identity identity = getIdentity(path.getIdentityKey());
      long lastResponseMs = request.getDateHeader("If-Modified-Since");
      Date lastResponse = null;
      if (lastResponseMs != -1) {
        lastResponse = new Date(lastResponseMs);
      }
View Full Code Here

   *
   * @param idKey
   * @return the Identity
   */
  private Identity getIdentity(Long idKey) {
    Identity identity = null;
    if (idKey != null) {
      identity = ManagerFactory.getManager().loadIdentityByKey(idKey);
    }
    return identity;
  }
View Full Code Here

   * @param path
   * @return true if the path may be dispatched.
   */
  private boolean hasAccess(OLATResourceable feed, Path path) {
    boolean hasAccess = false;
    Identity identity = getIdentity(path.getIdentityKey());

    if (path.isCourseType()) {
      // A course node is being requested
      OLATResourceable oresCourse = OLATResourceManager.getInstance()
          .findResourceable(path.getCourseId(), CourseModule.getCourseTypeName());
View Full Code Here

TOP

Related Classes of org.olat.core.id.Identity

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.