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

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

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

Run.checkPermission介绍

暂无

代码示例

代码示例来源:origin: jenkinsci/jenkins

/**
 * @param value
 *      Set to null to revert back to the default "#NNN".
 */
public void setDisplayName(String value) throws IOException {
  checkPermission(UPDATE);
  this.displayName = value;
  save();
}

代码示例来源:origin: jenkinsci/jenkins

public void keepLog(boolean newValue) throws IOException {
  checkPermission(newValue ? UPDATE : DELETE);
  keepLog = newValue;
  save();
}

代码示例来源:origin: jenkinsci/jenkins

public void setDescription(String description) throws IOException {
  checkPermission(UPDATE);
  this.description = description;
  save();
}

代码示例来源:origin: jenkinsci/jenkins

protected int run() throws Exception {
  Run run = job.getBuildByNumber(number);
  if (run == null)
    throw new IllegalArgumentException("No such build #"+number);
  run.checkPermission(Run.UPDATE);
  if ("=".equals(description)) {
    description = IOUtils.toString(stdin);
  }
  
  run.setDescription(description);
  
  return 0;
}

代码示例来源:origin: jenkinsci/jenkins

@Override
  protected int run() throws Exception {
    Run<?, ?> run = job.getBuildByNumber(number);
    if (run == null) {
      throw new IllegalArgumentException("Build #" + number + " does not exist");
    }
    run.checkPermission(Run.UPDATE);

    if ("-".equals(displayName)) {
      displayName = IOUtils.toString(stdin);
    }

    run.setDisplayName(displayName);

    return 0;
  }
}

代码示例来源:origin: jenkinsci/jenkins

@Override
  protected int run() throws Exception {
    Run r = getCurrentlyBuilding();
    r.checkPermission(Run.UPDATE);
    r.setResult(result);
    return 0;
  }
}

代码示例来源:origin: jenkinsci/jenkins

@RequirePOST
public @Nonnull HttpResponse doConfigSubmit( StaplerRequest req ) throws IOException, ServletException, FormException {
  checkPermission(UPDATE);
  try (BulkChange bc = new BulkChange(this)) {
    JSONObject json = req.getSubmittedForm();
    submit(json);
    bc.commit();
  }
  return FormApply.success(".");
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Serves the artifacts.
 * @throws AccessDeniedException Access denied
 */
public @Nonnull DirectoryBrowserSupport doArtifact() {
  if(Functions.isArtifactsPermissionEnabled()) {
   checkPermission(ARTIFACTS);
  }
  return new DirectoryBrowserSupport(this, getArtifactManager().root(), Messages.Run_ArtifactsBrowserTitle(project.getDisplayName(), getDisplayName()), "package.png", true);
}

代码示例来源:origin: jenkinsci/jenkins

@Override
  protected int run() throws Exception {
    Run r = getCurrentlyBuilding();
    r.checkPermission(Run.UPDATE);

    StringParameterValue p = new StringParameterValue(name, value);

    ParametersAction a = r.getAction(ParametersAction.class);
    if (a!=null) {
      r.replaceAction(a.createUpdated(Collections.singleton(p)));
    } else {
      r.addAction(new ParametersAction(p));
    }

    return 0;
  }
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Deletes the build when the button is pressed.
 */
@RequirePOST
public void doDoDelete( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
  checkPermission(DELETE);
  // We should not simply delete the build if it has been explicitly
  // marked to be preserved, or if the build should not be deleted
  // due to dependencies!
  String why = getWhyKeepLog();
  if (why!=null) {
    sendError(Messages.Run_UnableToDelete(getFullDisplayName(), why), req, rsp);
    return;
  }
  try{
    delete();
  }
  catch(IOException ex){
    req.setAttribute("stackTraces", Functions.printThrowable(ex));
    req.getView(this, "delete-retry.jelly").forward(req, rsp);  
    return;
  }
  rsp.sendRedirect2(req.getContextPath()+'/' + getParent().getUrl());
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

public void keepLog(boolean newValue) throws IOException {
  checkPermission(newValue ? UPDATE : DELETE);
  keepLog = newValue;
  save();
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

public void setDescription(String description) throws IOException {
  checkPermission(UPDATE);
  this.description = description;
  save();
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
 * @param value
 *      Set to null to revert back to the default "#NNN".
 */
public void setDisplayName(String value) throws IOException {
  checkPermission(UPDATE);
  this.displayName = value;
  save();
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

public void keepLog(boolean newValue) throws IOException {
  checkPermission(UPDATE);
  keepLog = newValue;
  save();
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

protected int run() throws Exception {
  Run run = job.getBuildByNumber(number);
  if (run == null)
    throw new IllegalArgumentException("No such build #"+number);
  run.checkPermission(Run.UPDATE);
  if ("=".equals(description)) {
    description = IOUtils.toString(stdin);
  }
  
  run.setDescription(description);
  
  return 0;
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

@Override
  protected int run() throws Exception {
    Run r = getCurrentlyBuilding();
    r.checkPermission(Run.UPDATE);
    r.setResult(result);
    return 0;
  }
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

@RequirePOST
public @Nonnull HttpResponse doConfigSubmit( StaplerRequest req ) throws IOException, ServletException, FormException {
  checkPermission(UPDATE);
  try (BulkChange bc = new BulkChange(this)) {
    JSONObject json = req.getSubmittedForm();
    submit(json);
    bc.commit();
  }
  return FormApply.success(".");
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
 * Serves the artifacts.
 * @throws AccessDeniedException Access denied
 */
public @Nonnull DirectoryBrowserSupport doArtifact() {
  if(Functions.isArtifactsPermissionEnabled()) {
   checkPermission(ARTIFACTS);
  }
  return new DirectoryBrowserSupport(this, getArtifactManager().root(), Messages.Run_ArtifactsBrowserTitle(project.getDisplayName(), getDisplayName()), "package.png", true);
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * Serves the artifacts.
 */
public DirectoryBrowserSupport doArtifact() {
  if(Functions.isArtifactsPermissionEnabled()) {
   checkPermission(ARTIFACTS);
  }
  return new DirectoryBrowserSupport(this,new FilePath(getArtifactsDir()), project.getDisplayName()+' '+getDisplayName(), "package.gif", true);
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * Serves the artifacts.
 */
public DirectoryBrowserSupport doArtifact() {
  if(Functions.isArtifactsPermissionEnabled()) {
   checkPermission(ARTIFACTS);
  }
  return new DirectoryBrowserSupport(this,new FilePath(getArtifactsDir()), project.getDisplayName()+' '+getDisplayName(), "package.png", true);
}

相关文章

微信公众号

最新文章

更多

Run类方法