当前位置: 首页>>代码示例>>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;未经允许,请勿转载。