hudson.model.Run.hasPermission()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中hudson.model.Run.hasPermission方法的一些代码示例,展示了Run.hasPermission的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Run.hasPermission方法的具体详情如下:
包路径:hudson.model.Run
类名称:Run
方法名:hasPermission

Run.hasPermission介绍

暂无

代码示例

代码示例来源:origin: jenkinsci/code-coverage-api-plugin

public boolean hasPermission() {
  return owner.hasPermission(Item.WORKSPACE);
}

代码示例来源:origin: org.jenkins-ci.plugins/python-wrapper

public boolean superHasPermission(Permission p) {
  return super.hasPermission(p);
}

代码示例来源:origin: jenkinsci/cobertura-plugin

public boolean hasPermission() {
  return owner.hasPermission(Item.WORKSPACE);
}

代码示例来源:origin: jenkinsci/analysis-core-plugin

/**
 * Checks if the file exists and the user is authorized to see the contents of the file.
 *
 * @return <code>true</code>, if successful
 */
@Override
public final boolean canDisplayFile(final Run<?, ?> owner) {
  if (owner.hasPermission(Item.WORKSPACE)) {
    return isInConsoleLog() || new File(getFileName()).exists() || new File(getTempName(owner)).exists();
  }
  return false;
}

代码示例来源:origin: jenkinsci/workflow-cps-plugin

/* accessible to Jelly */ public boolean isRebuildEnabled() {
  if (!run.hasPermission(Item.BUILD)) {
    return false;
  }
  if (!run.getParent().isBuildable()) {
    return false;
  }
  return true;
}

代码示例来源:origin: org.hudsonci.plugins/rest-plugin-api

@GET
@Path("{projectName}/builds")
public BuildsDTO getBuilds(final @PathParam("projectName") String projectName) {
  log.debug("Listing builds for project: {}", projectName);
  // securityService.checkPermission(Permission.READ); or Hudson.READ?  or fuck this
  AbstractProject<?, ?> project = support.getProject(projectName);
  project.checkPermission(READ); // FIXME: This is already done by ProjectServiceImpl.findProjectByFullName(), though not done when returning a multiconfig project
  BuildsDTO builds = new BuildsDTO();
  for (Run<?, ?> build : project.getBuilds()) {
    if (build.hasPermission(READ)) {
      builds.getBuilds().add(buildx.convert(build));
    }
  }
  return builds;
}

代码示例来源:origin: org.jenkins-ci.plugins/python-wrapper

@Override
public boolean hasPermission(Permission p) {
  initPython();
  if (pexec.isImplemented(56)) {
    return pexec.execPythonBool("has_permission", p);
  } else {
    return super.hasPermission(p);
  }
}

代码示例来源:origin: jenkinsci/envinject-plugin

/**
 * Checks if the current user can view injected variables in the run.
 * @param run Run to be checked
 * @return true if the injected variables can be displayed.
 */
@Restricted(NoExternalUse.class)
public static boolean canViewInjectedVars(@Nonnull Run<?,?> run) {
  // We allow security engines to block the output
  if (VIEW_INJECTED_VARS.getEnabled() &&  !run.hasPermission(VIEW_INJECTED_VARS)) {
    return false;
  }
  
  // Last check - global configs
  final EnvInjectPluginConfiguration configuration = getInstance().getConfiguration();
  return !configuration.isHideInjectedVars();
}

代码示例来源:origin: jenkinsci/pipeline-model-definition-plugin

@Exported
public boolean isRestartEnabled() {
  ExecutionModelAction executionModelAction = run.getAction(ExecutionModelAction.class);
  return executionModelAction != null &&
      !run.isBuilding() &&
      run.hasPermission(Item.BUILD) &&
      run.getParent().isBuildable() &&
      getExecution() != null;
}

代码示例来源:origin: jenkinsci/pipeline-model-definition-plugin

public Queue.Item run(String stageName) {
  if (stageName == null || stageName.equals("")) {
    throw new IllegalStateException(Messages.RestartDeclarativePipelineAction_NullStageName());
  }
  if (!run.hasPermission(Item.BUILD) || !run.getParent().isBuildable()) {
    throw new IllegalStateException(Messages.RestartDeclarativePipelineAction_ProjectNotBuildable(run.getParent().getFullName()));
  }
  if (run.isBuilding()) {
    throw new IllegalStateException(Messages.RestartDeclarativePipelineAction_OriginRunIncomplete(run.getFullDisplayName()));
  }
  ExecutionModelAction execAction = run.getAction(ExecutionModelAction.class);
  if (execAction == null) {
    throw new IllegalStateException(Messages.RestartDeclarativePipelineAction_OriginWasNotDeclarative(run.getFullDisplayName()));
  }
  if (!getRestartableStages().contains(stageName)) {
    throw new IllegalStateException(Messages.RestartDeclarativePipelineAction_StageNameNotPresent(stageName, run.getFullDisplayName()));
  }
  List<Action> actions = new ArrayList<>();
  CpsFlowExecution execution = getExecution();
  if (execution == null) {
    throw new IllegalStateException(Messages.RestartDeclarativePipelineAction_OriginRunMissingExecution(run.getFullDisplayName()));
  }
  actions.add(new RestartFlowFactoryAction(run.getExternalizableId()));
  actions.add(new CauseAction(new Cause.UserIdCause(), new RestartDeclarativePipelineCause(run, stageName)));
  return ParameterizedJobMixIn.scheduleBuild2(run.getParent(), 0, actions.toArray(new Action[actions.size()]));
}

代码示例来源:origin: jenkinsci/workflow-cps-plugin

/* accessible to Jelly */ public boolean isEnabled() {
  if (!run.hasPermission(REPLAY)) {
    return false;
  }
  if (!run.getParent().isBuildable()) {
    return false;
  }
  CpsFlowExecution exec = getExecutionLazy();
  if (exec != null) {
    return exec.isSandbox() || Jenkins.get().hasPermission(Jenkins.RUN_SCRIPTS); // We have to check for ADMIN because un-sandboxed code can execute arbitrary on-master code
  } else {
    // If the execution hasn't been lazy-loaded then we will wait to do deeper checks until someone tries to lazy load
    // OR until isReplayableSandboxTest is invoked b/c they actually try to replay the build
    return true;
  }
}

代码示例来源:origin: jenkinsci/embeddable-build-status-plugin

if(throwErrorWhenNotFound && (run == null || !run.hasPermission(VIEW_STATUS))){
  throw HttpResponses.notFound();

相关文章

微信公众号

最新文章

更多

Run类方法