示例#1
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;
 }
示例#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;
 }