Ejemplo n.º 1
0
 public AdminAndRoleSelections getAdminAndRoleSelections(List<String> users) {
   final SecurityConfig securityConfig = goConfigService.security();
   Set<Role> roles = allRoles(securityConfig);
   final List<TriStateSelection> roleSelections = TriStateSelection.forRoles(roles, users);
   final TriStateSelection adminSelection =
       TriStateSelection.forSystemAdmin(
           securityConfig.adminsConfig(),
           roles,
           new SecurityService.UserRoleMatcherImpl(securityConfig),
           users);
   return new AdminAndRoleSelections(adminSelection, roleSelections);
 }
Ejemplo n.º 2
0
 public void modifyEnvironments(List<AgentInstance> agents, List<TriStateSelection> selections) {
   GoConfigDao.CompositeConfigCommand command = new GoConfigDao.CompositeConfigCommand();
   for (AgentInstance agentInstance : agents) {
     String uuid = agentInstance.getUuid();
     if (hasAgent(uuid)) {
       for (TriStateSelection selection : selections) {
         command.addCommand(
             new ModifyEnvironmentCommand(uuid, selection.getValue(), selection.getAction()));
       }
     }
   }
   updateConfig(command);
 }