コード例 #1
0
ファイル: SecurityService.java プロジェクト: jango2015/gocd
  public boolean hasOperatePermissionForStage(
      String pipelineName, String stageName, String username) {
    if (!goConfigService.isSecurityEnabled()) {
      return true;
    }
    if (!goConfigService.hasStageConfigNamed(pipelineName, stageName)) {
      return false;
    }
    StageConfig stage = goConfigService.stageConfigNamed(pipelineName, stageName);
    CaseInsensitiveString userName = new CaseInsensitiveString(username);

    // TODO - #2517 - stage not exist
    if (stage.hasOperatePermissionDefined()) {
      CruiseConfig cruiseConfig = goConfigService.getCurrentConfig();
      String groupName =
          goConfigService.findGroupNameByPipeline(new CaseInsensitiveString(pipelineName));
      PipelineConfigs group = goConfigService.getCurrentConfig().findGroup(groupName);
      if (isUserAdmin(new Username(userName)) || isUserAdminOfGroup(userName, group)) {
        return true;
      }
      return goConfigService.readAclBy(pipelineName, stageName).isGranted(userName);
    }

    return hasOperatePermissionForPipeline(new CaseInsensitiveString(username), pipelineName);
  }
コード例 #2
0
ファイル: SecurityService.java プロジェクト: jango2015/gocd
 public boolean hasViewPermissionForPipeline(Username username, String pipelineName) {
   String groupName =
       goConfigService.findGroupNameByPipeline(new CaseInsensitiveString(pipelineName));
   if (groupName == null) {
     return true;
   }
   return hasViewPermissionForGroup(CaseInsensitiveString.str(username.getUsername()), groupName);
 }
コード例 #3
0
ファイル: SecurityService.java プロジェクト: jango2015/gocd
 public boolean hasOperatePermissionForPipeline(
     final CaseInsensitiveString username, String pipelineName) {
   String groupName =
       goConfigService.findGroupNameByPipeline(new CaseInsensitiveString(pipelineName));
   if (groupName == null) {
     return true;
   }
   return hasOperatePermissionForGroup(username, groupName);
 }