Package org.jamwiki.model

Examples of org.jamwiki.model.WikiUser


      // loop back to find the last non-delete edit
      previousVersion = WikiBase.getDataHandler().lookupTopicVersion(previousVersion.getPreviousTopicVersionId());
    }
    String contents = previousVersion.getVersionContent();
    topic.setTopicContent(contents);
    WikiUser user = ServletUtil.currentWikiUser();
    int charactersChanged = StringUtils.length(contents);
    TopicVersion topicVersion = new TopicVersion(user, ServletUtil.getIpAddress(request), request.getParameter("undeleteComment"), contents, charactersChanged);
    topicVersion.setEditType(TopicVersion.EDIT_UNDELETE);
    WikiBase.getDataHandler().undeleteTopic(topic, topicVersion);
  }
View Full Code Here


    // if (request.getParameter("watchTopic") != null ||
    // (watchlist.containsTopic(topicName) && !isPreview(request))) {
    // next.addObject("watchTopic", true);
    // }
    pageInfo.setContentJsp(JSP_EDIT);
    WikiUser user = ServletUtil.currentWikiUser();
    String editor = user.getEditor();
    next.addObject("editor", editor);
    next.addObject("contents", contents);
  }
View Full Code Here

          false);
      return;
    }
    // parse for signatures and other syntax that should not be saved in raw
    // form
    WikiUser user = ServletUtil.currentWikiUser();
    ParserInput parserInput = new ParserInput();
    parserInput.setContext(request.getContextPath());
    parserInput.setLocale(request.getLocale());
    parserInput.setWikiUser(user);
    parserInput.setTopicName(topicName);
View Full Code Here

      throw new WikiException(new WikiMessage("watchlist.error.loginrequired"));
    }
    String topicName = WikiUtil.getTopicFromRequest(request);
    String virtualWiki = pageInfo.getVirtualWikiName();
    Watchlist watchlist = ServletUtil.currentWatchlist(request, virtualWiki);
    WikiUser user = ServletUtil.currentWikiUser();
    WikiBase.getDataHandler().writeWatchlistEntry(watchlist, virtualWiki, topicName, user.getUserId());
    String article = WikiUtil.extractTopicLink(topicName);
    if (watchlist.containsTopic(topicName)) {
      // added to watchlist
      next.addObject("message", new WikiMessage("watchlist.caption.added", article));
    } else {
View Full Code Here

    Pagination pagination = ServletUtil.loadPagination(request, next);
    WikiUserDetails userDetails = ServletUtil.currentUserDetails();
    if (userDetails.hasRole(RoleImpl.ROLE_ANONYMOUS)) {
      throw new WikiException(new WikiMessage("watchlist.error.loginrequired"));
    }
    WikiUser user = ServletUtil.currentWikiUser();
    List<RecentChange> changes = WikiBase.getDataHandler().getWatchlist(virtualWiki, user.getUserId(), pagination);
    next.addObject("numChanges", changes.size());
    next.addObject("changes", changes);
    pageInfo.setPageTitle(new WikiMessage("watchlist.title"));
    pageInfo.setContentJsp(JSP_WATCHLIST);
    pageInfo.setSpecial(true);
View Full Code Here

   *
   */
  private Locale retrieveUserLocale(HttpServletRequest request) throws ServletException {
    Locale locale = null;
    try {
      WikiUser user = ServletUtil.currentWikiUser();
      locale = LocaleUtils.toLocale(user.getDefaultLocale());
    } catch (AuthenticationCredentialsNotFoundException e) {
      // do nothing, just use a default locale
    }
    return locale;
  }
View Full Code Here

   * @return The current logged-in <code>WikiUser</code>, or an empty WikiUser
   *         if there is no user currently logged in.
   */
  public static WikiUser currentWikiUser() throws AuthenticationCredentialsNotFoundException {
    WikiUserDetails userDetails = ServletUtil.currentUserDetails();
    WikiUser user = new WikiUser();
    String username = userDetails.getUsername();
    if (username.equals(WikiUserDetails.ANONYMOUS_USER_USERNAME)) {
      return user;
    }
    if (!WikiUtil.isFirstUse() && !WikiUtil.isUpgrade()) {
View Full Code Here

    WikiUserDetails userDetails = ServletUtil.currentUserDetails();
    Watchlist watchlist = new Watchlist();
    if (userDetails.hasRole(RoleImpl.ROLE_ANONYMOUS)) {
      return watchlist;
    }
    WikiUser user = ServletUtil.currentWikiUser();
    try {
      watchlist = WikiBase.getDataHandler().getWatchlist(virtualWiki, user.getUserId());
    } catch (DataAccessException e) {
      throw new WikiException(new WikiMessage("error.unknown", e.getMessage()), e);
    }
    if (request.getSession(false) != null) {
      // add watchlist to session
View Full Code Here

   * @return Either the user's default locale (for logged-in users) or the
   *         locale specified in the request if no default locale is available.
   */
  public static Locale retrieveUserLocale(HttpServletRequest request) {
    try {
      WikiUser user = ServletUtil.currentWikiUser();
      if (user.getDefaultLocale() != null) {
        return LocaleUtils.toLocale(user.getDefaultLocale());
      }
    } catch (AuthenticationCredentialsNotFoundException e) {
      // ignore
    }
    return request.getLocale();
View Full Code Here

    }
    // for LDAP and other authentication methods, verify that JAMWiki database records exist
    try {  
      if (WikiBase.getDataHandler().lookupWikiUser(username) == null) {
        // if there is a valid security credential & no JAMWiki record for the user, create one
        WikiUser user = new WikiUser(username);
        // default the password empty so that the user cannot login directly
        String encryptedPassword = "";
        WikiBase.getDataHandler().writeWikiUser(user, username, encryptedPassword);
      }
    } catch (DataAccessException e) {
View Full Code Here

TOP

Related Classes of org.jamwiki.model.WikiUser

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.