本文整理匯總了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);
}