Example #1
0
 /** Get User object by username */
 public UserWrapper getUser(String username) {
   UserWrapper wrappedUser = null;
   try {
     Weblogger roller = WebloggerFactory.getWeblogger();
     UserManager umgr = roller.getUserManager();
     User user = umgr.getUserByUserName(username, Boolean.TRUE);
     wrappedUser = UserWrapper.wrap(user);
   } catch (Exception e) {
     log.error("ERROR: fetching users by letter", e);
   }
   return wrappedUser;
 }
Example #2
0
 /*
  * Get most recent User objects, in reverse chrono order by creationDate.
  * @param offset   Offset into results (for paging)
  * @param len      Max number of results to return
  */
 public List getNewUsers(int sinceDays, int length) {
   List results = new ArrayList();
   try {
     Weblogger roller = WebloggerFactory.getWeblogger();
     UserManager umgr = roller.getUserManager();
     List users = umgr.getUsers(Boolean.TRUE, null, null, 0, length);
     for (Iterator it = users.iterator(); it.hasNext(); ) {
       User user = (User) it.next();
       results.add(UserWrapper.wrap(user));
     }
   } catch (Exception e) {
     log.error("ERROR: fetching weblog list", e);
   }
   return results;
 }
Example #3
0
 /** Return list of users that belong to website. */
 public List getWeblogsUsers(String handle) {
   List results = new ArrayList();
   try {
     Weblogger roller = WebloggerFactory.getWeblogger();
     UserManager umgr = roller.getUserManager();
     Weblog website = WebloggerFactory.getWeblogger().getWeblogManager().getWeblogByHandle(handle);
     List<WeblogPermission> perms = umgr.getWeblogPermissions(website);
     for (WeblogPermission perm : perms) {
       results.add(UserWrapper.wrap(perm.getUser()));
     }
   } catch (Exception e) {
     log.error("ERROR: fetching weblog list", e);
   }
   return results;
 }