本文整理汇总了Java中jenkins.model.Jenkins.hasPermission方法的典型用法代码示例。如果您正苦于以下问题:Java Jenkins.hasPermission方法的具体用法?Java Jenkins.hasPermission怎么用?Java Jenkins.hasPermission使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jenkins.model.Jenkins
的用法示例。
在下文中一共展示了Jenkins.hasPermission方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doFillCredentialsIdItems
import jenkins.model.Jenkins; //导入方法依赖的package包/类
/**
* Populates the list of credentials in the select box in CodeScene API configuration section
* Inspired by git plugin:
* https://github.com/jenkinsci/git-plugin/blob/f58648e9005293ab07b2389212603ff9a460b80a/src/main/java/jenkins/plugins/git/GitSCMSource.java#L239
*/
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Jenkins context, @QueryParameter String credentialsId) {
if (context == null || !context.hasPermission(Item.CONFIGURE)) {
return new StandardListBoxModel().includeCurrentValue(credentialsId);
}
return new StandardListBoxModel()
.includeEmptyValue()
.includeMatchingAs(
context instanceof Queue.Task ? Tasks.getAuthenticationOf((Queue.Task)context) : ACL.SYSTEM,
context,
StandardUsernameCredentials.class,
Collections.<DomainRequirement>emptyList(),
CredentialsMatchers.always())
.includeCurrentValue(credentialsId);
}
示例2: doFillCredentialsIdItems
import jenkins.model.Jenkins; //导入方法依赖的package包/类
public static ListBoxModel doFillCredentialsIdItems(String credentialsId) {
Jenkins jenkins = Jenkins.getInstance();
if (jenkins == null) {
return (ListBoxModel) null;
}
if (!jenkins.hasPermission(Jenkins.ADMINISTER)) {
// Important! Otherwise you expose credentials metadata to random
// web requests.
return new StandardListBoxModel().includeCurrentValue(credentialsId);
}
return new StandardListBoxModel().includeEmptyValue().includeAs(ACL.SYSTEM, jenkins, OpenShiftToken.class)
.includeCurrentValue(credentialsId);
}
示例3: getIconFileName
import jenkins.model.Jenkins; //导入方法依赖的package包/类
@Override
public String getIconFileName() {
// This _needs_ to be done in getIconFileName only because of JENKINS-33683.
Jenkins jenkins = jenkins();
if (!jenkins.hasPermission(Jenkins.ADMINISTER)) return null;
if (jenkins.clouds.isEmpty() && isEmpty()) return null;
return "graph.png";
}
示例4: isDisplayed
import jenkins.model.Jenkins; //导入方法依赖的package包/类
public boolean isDisplayed() {
Jenkins instance = Jenkins.getInstance();
return instance != null && !instance.clouds.isEmpty() && instance.hasPermission(Jenkins.ADMINISTER);
}