jenkins.model.Jenkins.checkPermission()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(253)

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

Jenkins.checkPermission介绍

暂无

代码示例

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

@Override
public Object getTarget() {
  Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
  return this;
}

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

public void checkPermission(Permission permission) {
  Jenkins.getInstance().checkPermission(permission);
}

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

@Override
@Restricted(NoExternalUse.class)
public Object getTarget() {
  if (!SKIP_PERMISSION_CHECK) {
    Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
  }
  return this;
}

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

@Override
@Restricted(NoExternalUse.class)
public Object getTarget() {
  if (!SKIP_PERMISSION_CHECK) {
    Jenkins.getInstance().checkPermission(Jenkins.READ);
  }
  return this;
}

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

@Override
@Restricted(NoExternalUse.class)
public Object getTarget() {
  if (!SKIP_PERMISSION_CHECK) {
    Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
  }
  return this;
}

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

@Override
@Restricted(NoExternalUse.class)
public Object getTarget() {
  if (!SKIP_PERMISSION_CHECK) {
    Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
  }
  return this;
}

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

public Api getApi() {
  Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
  return new Api(this);
}

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

public Api getApi() {
  Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
  return new Api(this);
}

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

public HttpResponse doDownload() throws IOException {
  Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
  return HttpResponses.staticResource(file);
}

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

@RequirePOST
@Deprecated
public HttpResponse doPin() throws IOException {
  Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
  // See https://groups.google.com/d/msg/jenkinsci-dev/kRobm-cxFw8/6V66uhibAwAJ
  LOGGER.log(WARNING, "Call to pin plugin has been ignored. Plugin name: " + shortName);
  return HttpResponses.ok();
}

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

@RequirePOST
@Deprecated
public HttpResponse doUnpin() throws IOException {
  Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
  // See https://groups.google.com/d/msg/jenkinsci-dev/kRobm-cxFw8/6V66uhibAwAJ
  LOGGER.log(WARNING, "Call to unpin plugin has been ignored. Plugin name: " + shortName);
  return HttpResponses.ok();
}

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

@RequirePOST
  public HttpResponse doDelete() throws IOException {
    Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
    file.delete();
    owner.files.remove(this);
    return HttpResponses.redirectTo("../..");
  }
}

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

/**
 * Configure the logging level.
 */
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings("LG_LOST_LOGGER_DUE_TO_WEAK_REFERENCE")
@RequirePOST
public HttpResponse doConfigLogger(@QueryParameter String name, @QueryParameter String level) {
  Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
  Level lv;
  if(level.equals("inherit"))
    lv = null;
  else
    lv = Level.parse(level.toUpperCase(Locale.ENGLISH));
  Logger.getLogger(name).setLevel(lv);
  return new HttpRedirect("levels");
}

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

/**
 * Invalidates the cached data and force retrieval.
 *
 * @since 1.432
 */
@RequirePOST
public HttpResponse doInvalidateData() {
  Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
  dataTimestamp = 0;
  data = null;
  return HttpResponses.ok();
}

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

public synchronized void set(String newContent) throws IOException {
  Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
  write(newContent);
  load2();
}

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

/**
 * Makes sure that the given name is good as an agent name.
 */
public FormValidation doCheckName(@QueryParameter String value) throws IOException, ServletException {
  Jenkins.getInstance().checkPermission(Computer.CREATE);
  if(Util.fixEmpty(value)==null)
    return FormValidation.ok();
  
  try {
    checkName(value);
    return FormValidation.ok();
  } catch (Failure e) {
    return FormValidation.error(e.getMessage());
  }
}

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

/**
 * Checks if the home directory is valid.
 * @since 1.563
 */
public FormValidation doCheckHome(@QueryParameter File value) {
  // this can be used to check the existence of a file on the server, so needs to be protected
  Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
  if (value.getPath().isEmpty()) {
    return FormValidation.ok();
  }
  if (!value.isDirectory()) {
    return FormValidation.warning(Messages.ToolDescriptor_NotADirectory(value));
  }
  return checkHomeDirectory(value);
}

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

/**
 * Snooze the upgrade wizard notice.
 */
@RequirePOST
public HttpResponse doSnooze() throws IOException {
  Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
  File f = SetupWizard.getUpdateStateFile();
  FileUtils.touch(f);
  f.setLastModified(System.currentTimeMillis() + TimeUnit.DAYS.toMillis(1));
  LOGGER.log(FINE, "Snoozed the upgrade wizard notice");
  return HttpResponses.redirectToContextRoot();
}

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

/**
 * Call this to hide the upgrade wizard
 */
public HttpResponse doHideUpgradeWizard() {
  Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
  HttpSession session = Stapler.getCurrentRequest().getSession(false);
  if(session != null) {
    session.removeAttribute(SHOW_UPGRADE_WIZARD_FLAG);
  }
  return HttpResponses.redirectToContextRoot();
}

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

/**
 * Call this to show the upgrade wizard
 */
public HttpResponse doShowUpgradeWizard() throws Exception {
  Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
  HttpSession session = Stapler.getCurrentRequest().getSession(true);
  session.setAttribute(SHOW_UPGRADE_WIZARD_FLAG, true);
  return HttpResponses.redirectToContextRoot();
}

相关文章

Jenkins类方法