hudson.security.AccessControlled.checkPermission()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(135)

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

AccessControlled.checkPermission介绍

[英]Convenient short-cut for getACL().checkPermission(permission)
[中]getACL()的便捷快捷方式。检查权限(权限)

代码示例

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

public static void checkPermission(AccessControlled object, Permission permission) throws IOException, ServletException {
  if (permission != null) {
    object.checkPermission(permission);
  }
}

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

private static void checkPermissionForValidate() {
  AccessControlled subject = Stapler.getCurrentRequest().findAncestorObject(AbstractProject.class);
  if (subject == null)
    Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
  else
    subject.checkPermission(Item.CONFIGURE);
}

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

res.getOutputStream().write(encrypted);
} else {
  it.checkPermission(connectPermission);
  view.forward(req, res);

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

/**
 * Runs the validation code.
 */
public final void process() throws IOException, ServletException {
  if(permission!=null)
    try {
      if(subject==null)
        throw new AccessDeniedException("No subject");
      subject.checkPermission(permission);
    } catch (AccessDeniedException e) {
      // if the user has hudson-wide admin permission, all checks are allowed
      // this is to protect Hudson administrator from broken ACL/SecurityRealm implementation/configuration.
      if(!Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER))
        throw e;
    }
  check();
}

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

/**
 * Called by {@link #doConfirmRename} and {@code rename.jelly} to validate renames.
 * @return {@link FormValidation#ok} if this item can be renamed as specified, otherwise
 * {@link FormValidation#error} with a message explaining the problem.
 */
@Restricted(NoExternalUse.class)
public @Nonnull FormValidation doCheckNewName(@QueryParameter String newName) {
  // TODO: Create an Item.RENAME permission to use here, see JENKINS-18649.
  if (!hasPermission(Item.CONFIGURE)) {
    if (parent instanceof AccessControlled) {
      ((AccessControlled)parent).checkPermission(Item.CREATE);
    }
    checkPermission(Item.DELETE);
  }
  newName = newName == null ? null : newName.trim();
  try {
    Jenkins.checkGoodName(newName);
    assert newName != null; // Would have thrown Failure
    if (newName.equals(name)) {
      return FormValidation.warning(Messages.AbstractItem_NewNameUnchanged());
    }
    Jenkins.get().getProjectNamingStrategy().checkName(newName);
    checkIfNameIsUsed(newName);
    checkRename(newName);
  } catch (Failure e) {
    return FormValidation.error(e.getMessage());
  }
  return FormValidation.ok();
}

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

@WebMethod(name="heapdump.hprof")
public void doHeapDump(StaplerRequest req, StaplerResponse rsp) throws IOException, InterruptedException {
  owner.checkPermission(Jenkins.RUN_SCRIPTS);
  rsp.setContentType("application/octet-stream");
  FilePath dump = obtain();
  try {
    dump.copyTo(rsp.getCompressedOutputStream(req));
  } finally {
    dump.delete();
  }
}

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

public synchronized TopLevelItem createProjectFromXML(String name, InputStream xml) throws IOException {
  acl.checkPermission(Item.CREATE);

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

public synchronized TopLevelItem createProject( TopLevelItemDescriptor type, String name, boolean notify )
    throws IOException {
  acl.checkPermission(Item.CREATE);
  type.checkApplicableIn(parent);
  acl.getACL().checkCreatePermission(parent, type);
  Jenkins.getInstance().getProjectNamingStrategy().checkName(name);
  Items.verifyItemDoesNotAlreadyExist(parent, name, null);
  TopLevelItem item = type.newInstance(parent, name);
  item.onCreatedFromScratch();
  item.save();
  add(item);
  Jenkins.getInstance().rebuildDependencyGraphAsync();
  if (notify)
    ItemListener.fireOnCreated(item);
  return item;
}

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

acl.checkPermission(Item.CREATE);
src.checkPermission(Item.EXTENDED_READ);
XmlFile srcConfigFile = Items.getConfigFile(src);

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

acl.checkPermission(Item.CREATE);

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

public static void checkPermission(AccessControlled object, Permission permission) throws IOException, ServletException {
  if (permission != null) {
    object.checkPermission(permission);
  }
}

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

public static void checkPermission(AccessControlled object, Permission permission) throws IOException, ServletException {
  if (permission != null) {
    object.checkPermission(permission);
  }
}

代码示例来源:origin: hudson/hudson-2.x

public static void checkPermission(AccessControlled object, Permission permission) throws IOException, ServletException {
  if (permission != null) {
    object.checkPermission(permission);
  }
}

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

public static void checkPermission(AccessControlled object, Permission permission) throws IOException, ServletException {
  if (permission != null) {
    object.checkPermission(permission);
  }
}

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

public void checkPermission(final AccessControlled controlled, final Permission permission) {
  checkNotNull(controlled);
  checkNotNull(permission);
  controlled.checkPermission(permission);
}

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

private static void checkPermissionForValidate() {
  AccessControlled subject = Stapler.getCurrentRequest().findAncestorObject(AbstractProject.class);
  if (subject == null)
    Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
  else
    subject.checkPermission(Item.CONFIGURE);
}

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

@WebMethod(name="heapdump.hprof")
public void doHeapDump(StaplerRequest req, StaplerResponse rsp) throws IOException, InterruptedException {
  owner.checkPermission(Jenkins.RUN_SCRIPTS);
  rsp.setContentType("application/octet-stream");
  FilePath dump = obtain();
  try {
    dump.copyTo(rsp.getCompressedOutputStream(req));
  } finally {
    dump.delete();
  }
}

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

@WebMethod(name="heapdump.hprof")
public void doHeapDump(StaplerRequest req, StaplerResponse rsp) throws IOException, InterruptedException {
  owner.checkPermission(Hudson.ADMINISTER);
  rsp.setContentType("application/octet-stream");
  FilePath dump = obtain();
  try {
    dump.copyTo(rsp.getCompressedOutputStream(req));
  } finally {
    dump.delete();
  }
}

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

@WebMethod(name = "heapdump.hprof")
public void doHeapDump(StaplerRequest req, StaplerResponse rsp) throws IOException, InterruptedException {
  owner.checkPermission(Hudson.ADMINISTER);
  rsp.setContentType("application/octet-stream");
  FilePath dump = obtain();
  try {
    dump.copyTo(rsp.getCompressedOutputStream(req));
  } finally {
    dump.delete();
  }
}

代码示例来源:origin: hudson/hudson-2.x

@WebMethod(name="heapdump.hprof")
public void doHeapDump(StaplerRequest req, StaplerResponse rsp) throws IOException, InterruptedException {
  owner.checkPermission(Hudson.ADMINISTER);
  rsp.setContentType("application/octet-stream");
  FilePath dump = obtain();
  try {
    dump.copyTo(rsp.getCompressedOutputStream(req));
  } finally {
    dump.delete();
  }
}

相关文章

微信公众号

最新文章

更多