Package org.olat.core.id

Examples of org.olat.core.id.Identity


      markRead(m, ureq.getIdentity());
      map.put("newMessage", Boolean.TRUE);
    }
    // add some data now
    Date creationDate = m.getCreationDate();
    Identity modifier = m.getModifier();
    if (modifier != null) {
      map.put("isModified", Boolean.TRUE);
      map.put("modfname", modifier.getUser().getProperty(UserConstants.FIRSTNAME, ureq.getLocale()));
      map.put("modlname", modifier.getUser().getProperty(UserConstants.LASTNAME, ureq.getLocale()));
    } else {
      map.put("isModified", Boolean.FALSE);
    }
    map.put("title", m.getTitle());
    map.put("body", m.getBody());
    map.put("date", f.formatDateAndTime(creationDate));
    Identity creator = m.getCreator();
    map.put("firstname", Formatter.truncate(creator.getUser().getProperty(UserConstants.FIRSTNAME, ureq.getLocale()),18)); //keeps the first 15 chars
    map.put("lastname", Formatter.truncate(creator.getUser().getProperty(UserConstants.LASTNAME, ureq.getLocale()),18));

//    map.put("username", Formatter.truncate(creator.getName(),18));
   
    map.put("modified", f.formatDateAndTime(m.getLastModified()));
    // message attachments
    OlatRootFolderImpl msgContainer = fm.getMessageContainer(forum.getKey(), m.getKey());
    map.put("messageContainer", msgContainer);
    List<VFSItem> attachments = new ArrayList<VFSItem>(msgContainer.getItems(new VFSItemExcludePrefixFilter(MessageEditController.ATTACHMENT_EXCLUDE_PREFIXES)));
//    List attachments = msgContainer.getItems();
    map.put("attachments", attachments);
    if (attachments == null || attachments.size() == 0) map.put("hasAttachments", Boolean.FALSE);
    else map.put("hasAttachments", Boolean.TRUE);
    // number of children and modify/delete permissions
    int numOfChildren;
    numOfChildren = countNumOfChildren(m, threadMsgs);
    Integer nOfCh = new Integer(numOfChildren);
    map.put("nOfCh", nOfCh);
    boolean userIsMsgCreator = ureq.getIdentity().getKey().equals(creator.getKey());
    Boolean uIsMsgC = new Boolean(userIsMsgCreator);
    map.put("uIsMsgC", uIsMsgC);
    boolean isThreadtop = m.getThreadtop()==null;
    map.put("isThreadtop", Boolean.valueOf(isThreadtop));
    boolean isThreadClosed = Status.getStatus(m.getStatusCode()).isClosed();
View Full Code Here


   * @param identity
   * @param newPwd
   * @return
   */
  public static boolean changePasswordAsAdmin(Identity identity, String newPwd) {
    Identity adminUserIdentity = ManagerFactory.getManager().findIdentityByName("administrator");
    return changePassword(adminUserIdentity, identity, newPwd);
  }
View Full Code Here

 
  protected List<UserInfo> getUserInfoList() {
    Map<Identity,UserInfo> infoMap = new HashMap<Identity,UserInfo>();
   
    for(Message msg:msgs) {
      Identity creator = msg.getCreator();
      if(creator == null) continue;
      UserInfo stats = infoMap.get(creator);
      if(stats == null) {
        stats = new UserInfo(creator);
        stats.setLastModified(msg.getLastModified());
View Full Code Here

   
    map.put("newMessage", Boolean.FALSE);

    // add some data now
    Date creationDate = m.getCreationDate();
    Identity modifier = m.getModifier();
    if (modifier != null) {
      map.put("isModified", Boolean.TRUE);
      map.put("modfname", modifier.getUser().getProperty(UserConstants.FIRSTNAME, ureq.getLocale()));
      map.put("modlname", modifier.getUser().getProperty(UserConstants.LASTNAME, ureq.getLocale()));
    } else {
      map.put("isModified", Boolean.FALSE);
    }
    map.put("title", m.getTitle());
    map.put("body", m.getBody());
    map.put("date", dateFormat.format(creationDate));
    Identity creator = m.getCreator();
    map.put("firstname", Formatter.truncate(creator.getUser().getProperty(UserConstants.FIRSTNAME, ureq.getLocale()),18)); //keeps the first 15 chars
    map.put("lastname", Formatter.truncate(creator.getUser().getProperty(UserConstants.LASTNAME, ureq.getLocale()),18));

//    map.put("username", Formatter.truncate(creator.getName(),18));
   
    map.put("modified", dateFormat.format(m.getLastModified()));
    // message attachments
    ForumManager fm = ForumManager.getInstance();
    OlatRootFolderImpl msgContainer = fm.getMessageContainer(forum.getKey(), m.getKey());
    map.put("messageContainer", msgContainer);
    List<VFSItem> attachments = new ArrayList<VFSItem>(msgContainer.getItems(new VFSItemExcludePrefixFilter(MessageEditController.ATTACHMENT_EXCLUDE_PREFIXES)));
//    List attachments = msgContainer.getItems();
    map.put("attachments", attachments);
    if (attachments == null || attachments.size() == 0) map.put("hasAttachments", Boolean.FALSE);
    else map.put("hasAttachments", Boolean.TRUE);
    // number of children and modify/delete permissions
    map.put("nOfCh", new Integer(1));
    boolean userIsMsgCreator = ureq.getIdentity().getKey().equals(creator.getKey());
    Boolean uIsMsgC = new Boolean(userIsMsgCreator);
    map.put("uIsMsgC", uIsMsgC);
    boolean isThreadtop = m.getThreadtop()==null;
    map.put("isThreadtop", Boolean.valueOf(isThreadtop));
    boolean isThreadClosed = Status.getStatus(m.getStatusCode()).isClosed();
View Full Code Here

  public static Document createDocument(SearchResourceContext searchResourceContext, WikiPage wikiPage) {   
    WikiPageDocument wikiPageDocument = new WikiPageDocument();

    long userId = wikiPage.getInitalAuthor();
    if (userId != 0) {
      Identity  identity = identityManager.loadIdentityByKey(Long.valueOf(userId));
      wikiPageDocument.setAuthor(identity.getName());
    }
    wikiPageDocument.setTitle(wikiPage.getPageName());
    wikiPageDocument.setContent(getContent(wikiPage));
    wikiPageDocument.setCreatedDate(new Date(wikiPage.getCreationTime()));
    wikiPageDocument.setLastChange(new Date(wikiPage.getModificationTime()));
View Full Code Here

    }

    public void getResult(String searchValue, ListReceiver receiver) {
      searchValue = searchValue == null ? null : searchValue.toLowerCase();
      for(UserInfo info:stats) {
        Identity identity = info.getIdentity();
        String name = identity.getName();
       
        if(identity.getName().startsWith(searchValue)) {
          receiver.addEntry(name, info.getLastName() + " " + info.getFirstName());
        } else if(info.getFirstNameLowerCase().startsWith(searchValue)) {
          receiver.addEntry(name, info.getLastName() + " " + info.getFirstName());
        } else if(info.getLastNameLowerCase().startsWith(searchValue)) {
          receiver.addEntry(name, info.getLastName() + " " + info.getFirstName());
View Full Code Here

      this.infos = infos;
    }
   
    public UserInfo getUserInfo(String username) {
      for(UserInfo info:infos) {
        Identity id = info.getIdentity();
        if(username.equals(id.getName())) {
          return info;
        }
      }
      return null;
    }
View Full Code Here

      return null;
    }
   
    public UserInfo getUserInfoByKey(Long key) {
      for (UserInfo info : infos) {
        Identity id = info.getIdentity();
        if (key.equals(id.getKey())) { return info; }
      }
      return null;
    }
View Full Code Here

      // if it's a link try to get attached identity and assume that user wants
      // to see the users home page
      Link userLink = (Link) source;
      Object userObject = userLink.getUserObject();
      if (userObject instanceof Identity) {
        Identity chosenIdentity = (Identity) userObject;
        HomePageConfigManager hpcm = HomePageConfigManagerImpl.getInstance();
        OLATResourceable ores = hpcm.loadConfigFor(chosenIdentity.getName());
        DTabs dts = (DTabs) Windows.getWindows(ureq).getWindow(ureq).getAttribute("DTabs");
        // was brasato:: DTabs dts = getWindowControl().getDTabs();
        DTab dt = dts.getDTab(ores);
        if (dt == null) {
          // does not yet exist -> create and add
          dt = dts.createDTab(ores, chosenIdentity.getName());
          if (dt == null) return;
          UserInfoMainController uimc = new UserInfoMainController(ureq, dt.getWindowControl(), chosenIdentity);
          dt.setController(uimc);
          dts.addDTab(dt);
        }
View Full Code Here

   *
   * @param username the OLAT username
   * @return the password used for instant messaging
   */
  public String getInstantMessagingCredentialsForUser(String username) {
    Identity identity = ManagerFactory.getManager().findIdentityByName(username);
    if (identity==null) {
      // OLAT-3556: masking this error temporarily
      //@TODO
      //@FIXME
      Tracing.logWarn("Identity not found for username="+username, ClientManagerImpl.class);
      return null;
    }
    // synchronized: not needed here, since the credentials are only created once for a user (when that user logs in for the very first time).
    // And a user will almost! never log in at the very same time from two different machines.
    Authentication auth = ManagerFactory.getManager().findAuthentication(identity, PROVIDER_INSTANT_MESSAGING);
    InstantMessaging im = InstantMessagingModule.getAdapter();
    if (auth == null) { // create new authentication for provider and also a new IM-account
     
      //if account exists on IM server but not on OLAT delete it first
      if (im.hasAccount(username)) {
        im.deleteAccount(username);
      }
     
      String pw = RandomStringUtils.randomAlphanumeric(6);
      if (im.createAccount(username, pw,
          getFullname(identity), identity.getUser().getProperty(UserConstants.EMAIL, null))) {
        auth = ManagerFactory.getManager().createAndPersistAuthentication(identity, PROVIDER_INSTANT_MESSAGING,
            identity.getName().toLowerCase(), pw);
        Tracing.logAudit("New instant messaging authentication account created for user:" + username, this.getClass());
        return auth.getCredential();
      } else {
        Tracing.logWarn("new instant messaging account creation failed for user: " + username, ClientManagerImpl.class);
        return null;
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.