Ejemplo n.º 1
0
 public void removeWatcher(Run run, Long userId) throws IOException {
   User user = securityManager.getUserById(userId);
   if (user != null) {
     Run clone = runs.get(run.getId());
     if (clone == null) {
       run.removeWatcher(user);
       push(run);
     } else {
       clone.removeWatcher(user);
     }
   }
 }
Ejemplo n.º 2
0
 public void updateGroupWatcher(Long userId) throws IOException {
   User user = securityManager.getUserById(userId);
   if (user != null) {
     for (Run r : runs.values()) {
       if (user.getGroups().contains(securityManager.getGroupByName("RunWatchers"))) {
         addWatcher(r, userId);
       } else {
         if (r.getSecurityProfile() != null
             && r.getSecurityProfile().getOwner() != null
             && !r.getSecurityProfile().getOwner().equals(user)) {
           removeWatcher(r, userId);
         }
       }
     }
   }
 }