コード例 #1
0
 @Override
 public Collection<User> getPossibleOwners(Node item) {
   if (OwnershipPlugin.getInstance().isRequiresConfigureRights()) {
     IUserFilter filter = new AccessRightsFilter(item, Computer.CONFIGURE);
     return UserCollectionFilter.filterUsers(User.getAll(), true, filter);
   } else {
     return User.getAll();
   }
 }
コード例 #2
0
ファイル: View.java プロジェクト: arangamani/jenkins
 @Override
 protected void compute() throws Exception {
   int itemCount = 0;
   for (Item item : items) {
     for (Job<?, ?> job : item.getAllJobs()) {
       if (job instanceof AbstractProject) {
         AbstractProject<?, ?> p = (AbstractProject) job;
         RunList<? extends AbstractBuild<?, ?>> builds = p.getBuilds();
         int buildCount = 0;
         for (AbstractBuild<?, ?> build : builds) {
           if (canceled()) {
             return;
           }
           for (ChangeLogSet.Entry entry : build.getChangeSet()) {
             User user = entry.getAuthor();
             UserInfo info = users.get(user);
             if (info == null) {
               UserInfo userInfo = new UserInfo(user, p, build.getTimestamp());
               userInfo.avatar = UserAvatarResolver.resolveOrNull(user, iconSize);
               synchronized (this) {
                 users.put(user, userInfo);
                 modified.add(user);
               }
             } else if (info.getLastChange().before(build.getTimestamp())) {
               synchronized (this) {
                 info.project = p;
                 info.lastChange = build.getTimestamp();
                 modified.add(user);
               }
             }
           }
           // TODO consider also adding the user of the UserCause when applicable
           buildCount++;
           progress((itemCount + 1.0 * buildCount / builds.size()) / (items.size() + 1));
         }
       }
     }
     itemCount++;
     progress(1.0 * itemCount / (items.size() + /* handling User.getAll */ 1));
   }
   if (unknown != null) {
     if (canceled()) {
       return;
     }
     for (User u : User.getAll()) { // TODO nice to have a method to iterate these lazily
       if (u == unknown) {
         continue;
       }
       if (!users.containsKey(u)) {
         UserInfo userInfo = new UserInfo(u, null, null);
         userInfo.avatar = UserAvatarResolver.resolveOrNull(u, iconSize);
         synchronized (this) {
           users.put(u, userInfo);
           modified.add(u);
         }
       }
     }
   }
 }
コード例 #3
0
 /**
  * All users who can login to the system.
  */
 public List<User> getAllUsers() {
     List<User> r = new ArrayList<User>();
     for (User u : User.getAll()) {
         if(u.getProperty(Details.class)!=null)
             r.add(u);
     }
     Collections.sort(r);
     return r;
 }
コード例 #4
0
ファイル: View.java プロジェクト: zlosch/jenkins
 public People(Jenkins parent) {
   this.parent = parent;
   // for Hudson, really load all users
   Map<User, UserInfo> users = getUserInfo(parent.getItems());
   User unknown = User.getUnknown();
   for (User u : User.getAll()) {
     if (u == unknown) continue; // skip the special 'unknown' user
     if (!users.containsKey(u)) users.put(u, new UserInfo(u, null, null));
   }
   this.users = toList(users);
 }
コード例 #5
0
  @Override
  public WwpassIdentity loadUserByUsername(String puid)
      throws UsernameNotFoundException, DataAccessException {
    Collection<User> all = User.getAll();

    for (User u : all) {
      WwpassIdentity p = u.getProperty(WwpassIdentity.class);
      if (puid.equals(p != null ? p.getPuid() : null)) {
        return p;
      }
    }

    throw new UsernameNotFoundException("There is no any user with: " + puid);
  }
コード例 #6
0
 /**
  * Computes if this Jenkins has some user accounts configured.
  *
  * <p>This is used to check for the initial
  */
 private static boolean hasSomeUser() {
   for (User u : User.getAll()) if (u.getProperty(WwpassIdentity.class) != null) return true;
   return false;
 }
コード例 #7
0
ファイル: View.java プロジェクト: alexkogon/jenkins
 @Override
 protected void compute() throws Exception {
   int itemCount = 0;
   for (Item item : items) {
     for (Job<?, ?> job : item.getAllJobs()) {
       if (job instanceof AbstractProject) {
         AbstractProject<?, ?> p = (AbstractProject) job;
         RunList<? extends AbstractBuild<?, ?>> builds = p.getBuilds();
         int buildCount = 0;
         for (AbstractBuild<?, ?> build : builds) {
           if (canceled()) {
             return;
           }
           for (ChangeLogSet.Entry entry : build.getChangeSet()) {
             User user = entry.getAuthor();
             UserInfo info = users.get(user);
             if (info == null) {
               UserInfo userInfo = new UserInfo(user, p, build.getTimestamp());
               userInfo.avatar = UserAvatarResolver.resolveOrNull(user, iconSize);
               synchronized (this) {
                 users.put(user, userInfo);
                 modified.add(user);
               }
             } else if (info.getLastChange().before(build.getTimestamp())) {
               synchronized (this) {
                 info.project = p;
                 info.lastChange = build.getTimestamp();
                 modified.add(user);
               }
             }
           }
           // TODO consider also adding the user of the UserCause when applicable
           buildCount++;
           // TODO this defeats lazy-loading. Should rather do a breadth-first search, as in
           // hudson.plugins.view.dashboard.builds.LatestBuilds
           // (though currently there is no quick implementation of RunMap.size() ~
           // idOnDisk.size(), which would be needed for proper progress)
           progress((itemCount + 1.0 * buildCount / builds.size()) / (items.size() + 1));
         }
       }
     }
     itemCount++;
     progress(1.0 * itemCount / (items.size() + /* handling User.getAll */ 1));
   }
   if (unknown != null) {
     if (canceled()) {
       return;
     }
     for (User u : User.getAll()) { // TODO nice to have a method to iterate these lazily
       if (canceled()) {
         return;
       }
       if (u == unknown) {
         continue;
       }
       if (!users.containsKey(u)) {
         UserInfo userInfo = new UserInfo(u, null, null);
         userInfo.avatar = UserAvatarResolver.resolveOrNull(u, iconSize);
         synchronized (this) {
           users.put(u, userInfo);
           modified.add(u);
         }
       }
     }
   }
 }