Esempio n. 1
0
 public Users findValidSubscribers(final StageConfigIdentifier identifier) {
   Users users = userDao.findNotificationSubscribingUsers();
   return users.filter(
       new Filter<User>() {
         public boolean matches(User user) {
           return user.hasSubscribedFor(identifier.getPipelineName(), identifier.getStageName())
               && securityService.hasViewPermissionForPipeline(
                   user.getName(), identifier.getPipelineName());
         }
       });
 }
Esempio n. 2
0
 public void modifyRolesAndUserAdminPrivileges(
     final List<String> users,
     final TriStateSelection adminPrivilege,
     final List<TriStateSelection> roleSelections,
     LocalizedOperationResult result) {
   Users allUsers = userDao.allUsers();
   for (String user : users) {
     if (!allUsers.containsUserNamed(user)) {
       result.badRequest(LocalizedMessage.string("USER_DOES_NOT_EXIST_IN_DB", user));
       return;
     }
   }
   try {
     final GoConfigDao.CompositeConfigCommand command = new GoConfigDao.CompositeConfigCommand();
     command.addCommand(goConfigService.modifyRolesCommand(users, roleSelections));
     command.addCommand(goConfigService.modifyAdminPrivilegesCommand(users, adminPrivilege));
     goConfigService.updateConfig(command);
   } catch (Exception e) {
     result.badRequest(LocalizedMessage.string("INVALID_ROLE_NAME", e.getMessage()));
   }
 }