Exemplo n.º 1
0
 private boolean isValidGroup(
     String groupName, CruiseConfig cruiseConfig, HttpLocalizedOperationResult result) {
   if (!cruiseConfig.hasPipelineGroup(groupName)) {
     result.notFound(
         LocalizedMessage.string("PIPELINE_GROUP_NOT_FOUND", groupName),
         HealthStateType.general(HealthStateScope.forGroup(groupName)));
     return false;
   }
   return true;
 }
Exemplo n.º 2
0
 public Set<String> usersThatCanOperateOnStage(
     CruiseConfig cruiseConfig, PipelineConfig pipelineConfig) {
   SortedSet<String> users = new TreeSet<String>();
   PipelineConfigs group = cruiseConfig.findGroupOfPipeline(pipelineConfig);
   if (group.hasAuthorizationDefined()) {
     if (group.hasOperationPermissionDefined()) {
       users.addAll(group.getOperateUserNames());
       List<String> roles = group.getOperateRoleNames();
       for (Role role : cruiseConfig.server().security().getRoles()) {
         if (roles.contains(CaseInsensitiveString.str(role.getName()))) {
           users.addAll(role.usersOfRole());
         }
       }
     }
   } else {
     users.addAll(allUsernames());
   }
   return users;
 }
Exemplo n.º 3
0
 public Set<String> rolesThatCanOperateOnStage(
     CruiseConfig cruiseConfig, PipelineConfig pipelineConfig) {
   PipelineConfigs group = cruiseConfig.findGroupOfPipeline(pipelineConfig);
   SortedSet<String> roles = new TreeSet<String>();
   if (group.hasAuthorizationDefined()) {
     if (group.hasOperationPermissionDefined()) {
       roles.addAll(group.getOperateRoleNames());
     }
   } else {
     roles.addAll(allRoleNames(cruiseConfig));
   }
   return roles;
 }
Exemplo n.º 4
0
 public PipelineConfigDependencyGraph upstreamDependencyGraphOf(
     String pipelineName, CruiseConfig currentConfig) {
   return findUpstream(
       currentConfig.pipelineConfigByName(new CaseInsensitiveString(pipelineName)));
 }
Exemplo n.º 5
0
 protected Object valid() {
   CruiseConfig config = configForEditing();
   PipelineConfigs group = config.findGroup(groupName);
   return group.getCopyForEditing();
 }
Exemplo n.º 6
0
 protected final CruiseConfig configForEditing() {
   CruiseConfig config = getConfigForEditing();
   this.md5 = config.getMd5();
   return config;
 }
Exemplo n.º 7
0
 public Collection<Role> allRoles(CruiseConfig cruiseConfig) {
   return cruiseConfig.server().security().getRoles();
 }