當前位置: 首頁>>代碼示例>>Java>>正文


Java Jenkins.hasPermission方法代碼示例

本文整理匯總了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);
}
 
開發者ID:empear-analytics,項目名稱:codescene-jenkins-plugin,代碼行數:20,代碼來源:CodeSceneBuilder.java

示例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);
}
 
開發者ID:jenkinsci,項目名稱:openshift-sync-plugin,代碼行數:16,代碼來源:GlobalPluginConfiguration.java

示例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";
}
 
開發者ID:jenkinsci,項目名稱:cloud-stats-plugin,代碼行數:9,代碼來源:CloudStatistics.java

示例4: isDisplayed

import jenkins.model.Jenkins; //導入方法依賴的package包/類
public boolean isDisplayed() {
    Jenkins instance = Jenkins.getInstance();
    return instance != null && !instance.clouds.isEmpty() && instance.hasPermission(Jenkins.ADMINISTER);
}
 
開發者ID:jenkinsci,項目名稱:cloud-stats-plugin,代碼行數:5,代碼來源:StatsWidget.java


注:本文中的jenkins.model.Jenkins.hasPermission方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。