Ejemplo n.º 1
0
 public PipelineConfigs removePipeline(String pipelineName, CruiseConfig cruiseConfig) {
   String groupName =
       cruiseConfig.getGroups().findGroupNameByPipeline(new CaseInsensitiveString(pipelineName));
   PipelineConfigs groups = cruiseConfig.getGroups().findGroup(groupName);
   groups.remove(cruiseConfig.pipelineConfigByName(new CaseInsensitiveString(pipelineName)));
   return groups;
 }
Ejemplo n.º 2
0
 public void removePipeline(String pipelineName) {
   CruiseConfig cruiseConfig = loadForEdit();
   PipelineConfigs groups = removePipeline(pipelineName, cruiseConfig);
   if (groups.isEmpty()) {
     cruiseConfig.getGroups().remove(groups);
   }
   writeConfigFile(cruiseConfig);
 }
Ejemplo n.º 3
0
 public void setViewPermissionForGroup(String groupName, String username) {
   CruiseConfig cruiseConfig = loadForEdit();
   PipelineConfigs group = cruiseConfig.getGroups().findGroup(groupName);
   group
       .getAuthorization()
       .getViewConfig()
       .add(new AdminUser(new CaseInsensitiveString(username)));
   writeConfigFile(cruiseConfig);
 }
Ejemplo n.º 4
0
 public void blockPipelineGroupExceptFor(String pipelineGroupName, String roleName) {
   CruiseConfig config = loadForEdit();
   PipelineConfigs configs = config.getGroups().findGroup(pipelineGroupName);
   Authorization authorization =
       new Authorization(
           new OperationConfig(new AdminRole(new CaseInsensitiveString(roleName))),
           new ViewConfig(new AdminRole(new CaseInsensitiveString(roleName))));
   configs.setAuthorization(authorization);
   writeConfigFile(config);
 }
Ejemplo n.º 5
0
 public void setOperatePermissionForGroup(String groupName, String... userNames) {
   CruiseConfig cruiseConfig = loadForEdit();
   Admin[] admins = AdminUserMother.adminUsers(userNames);
   for (Admin admin : admins) {
     cruiseConfig
         .getGroups()
         .findGroup(groupName)
         .getAuthorization()
         .getOperationConfig()
         .add(admin);
   }
   writeConfigFile(cruiseConfig);
 }
Ejemplo n.º 6
0
 public void addAuthorizedUserForPipelineGroup(String user) {
   CruiseConfig cruiseConfig = loadForEdit();
   PipelineConfigs group = cruiseConfig.getGroups().first();
   group.getAuthorization().getViewConfig().add(new AdminUser(new CaseInsensitiveString(user)));
   writeConfigFile(cruiseConfig);
 }