示例#1
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;
 }
示例#2
0
 /** Return list of weblogs that user belongs to. */
 public List getUsersWeblogs(String userName) {
   List results = new ArrayList();
   try {
     Weblogger roller = WebloggerFactory.getWeblogger();
     UserManager umgr = roller.getUserManager();
     User user = umgr.getUserByUserName(userName);
     List<WeblogPermission> perms = umgr.getWeblogPermissions(user);
     for (WeblogPermission perm : perms) {
       results.add(WeblogWrapper.wrap(perm.getWeblog(), urlStrategy));
     }
   } catch (Exception e) {
     log.error("ERROR: fetching weblog list", e);
   }
   return results;
 }