本文整理了Java中hudson.model.Item.checkPermission()
方法的一些代码示例,展示了Item.checkPermission()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Item.checkPermission()
方法的具体详情如下:
包路径:hudson.model.Item
类名称:Item
方法名:checkPermission
暂无
代码示例来源:origin: jenkinsci/promoted-builds-plugin
/**
* Checks the job name.
*/
public FormValidation doCheckJobName(@AncestorInPath Item project, @QueryParameter String value ) {
final Jenkins jenkins = Jenkins.getInstance();
if (jenkins == null) {
return FormValidation.error("Jenkins instance is not ready");
}
if (!project.hasPermission(Item.CONFIGURE) && project.hasPermission(Item.EXTENDED_READ)) {
return FormValidation.ok();
}
project.checkPermission(Item.CONFIGURE);
if (StringUtils.isNotBlank(value)) {
// JENKINS-25011: also look for jobs in folders.
final AbstractProject p = ItemPathResolver.getByPath(value, project, AbstractProject.class);
if (p==null) {
// suggest full name so that getBuilds() can find item.
AbstractProject nearest = AbstractProject.findNearest(value, project.getParent());
return FormValidation.error( nearest != null
? hudson.tasks.Messages.BuildTrigger_NoSuchProject(value, nearest.getFullName())
: hudson.plugins.promoted_builds.Messages.Shared_noSuchProject(value));
}
}
return FormValidation.ok();
}
代码示例来源:origin: jenkinsci/promoted-builds-plugin
/**
* Checks the job name.
* @param project Current project
* @param value Value to be validated
* @return Validation result
*/
public FormValidation doCheckJobName(@AncestorInPath Item project, @QueryParameter String value ) {
if (!project.hasPermission(Item.CONFIGURE) && project.hasPermission(Item.EXTENDED_READ)) {
return FormValidation.ok();
}
project.checkPermission(Item.CONFIGURE);
if (StringUtils.isNotBlank(value)) {
AbstractProject p = JenkinsHelper.getInstance().getItem(value,project,AbstractProject.class);
if(p==null) {
AbstractProject nearest = AbstractProject.findNearest(value, project.getParent());
return FormValidation.error( nearest != null
? hudson.tasks.Messages.BuildTrigger_NoSuchProject(value, nearest.getRelativeNameFrom(project))
: Messages.Shared_noSuchProject(value));
}
}
return FormValidation.ok();
}
代码示例来源:origin: org.jenkins-ci.plugins/cloudbees-folder
public HttpResponse doMove(StaplerRequest req, @AncestorInPath Item item, @QueryParameter String destination)
throws IOException, InterruptedException {
item.checkPermission(RelocationAction.RELOCATE);
ItemGroup dest = null;
for (ItemGroup itemGroup : listDestinations(item)) {
代码示例来源:origin: jenkinsci/cloudbees-folder-plugin
public HttpResponse doMove(StaplerRequest req, @AncestorInPath Item item, @QueryParameter String destination)
throws IOException, InterruptedException {
item.checkPermission(RelocationAction.RELOCATE);
ItemGroup dest = null;
for (ItemGroup itemGroup : listDestinations(item)) {
代码示例来源:origin: jenkinsci/jira-plugin
Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
} else {
item.checkPermission(Item.CONFIGURE);
代码示例来源:origin: org.jenkins-ci.plugins/pipeline-build-step
throw new AbortException("No item named " + job + " found");
item.checkPermission(Item.BUILD);
if (step.getWait() && !(item instanceof Job)) {
代码示例来源:origin: jenkinsci/promoted-builds-plugin
/**
* Fills in the available promotion processes.
* @param defaultJob Base job
* @param jobName Current name of the job specified in the form
* @return List of possible project names. May be empty
*/
public ListBoxModel doFillProcessItems(@AncestorInPath Item defaultJob, @QueryParameter("jobName") String jobName) {
if (!defaultJob.hasPermission(Item.CONFIGURE) && defaultJob.hasPermission(Item.EXTENDED_READ)) {
return new ListBoxModel();
}
defaultJob.checkPermission(Item.CONFIGURE);
AbstractProject<?,?> j = null;
if (jobName!=null)
j = JenkinsHelper.getInstance().getItem(jobName,defaultJob,AbstractProject.class);
ListBoxModel r = new ListBoxModel();
if (j!=null) {
JobPropertyImpl pp = j.getProperty(JobPropertyImpl.class);
if (pp!=null) {
for (PromotionProcess proc : pp.getActiveItems())
r.add(new Option(proc.getDisplayName(),proc.getName()));
}
}
return r;
}
}
内容来源于网络,如有侵权,请联系作者删除!