当前位置: 首页>>代码示例>>Java>>正文


Java StandardListBoxModel类代码示例

本文整理汇总了Java中com.cloudbees.plugins.credentials.common.StandardListBoxModel的典型用法代码示例。如果您正苦于以下问题:Java StandardListBoxModel类的具体用法?Java StandardListBoxModel怎么用?Java StandardListBoxModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


StandardListBoxModel类属于com.cloudbees.plugins.credentials.common包,在下文中一共展示了StandardListBoxModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doFillCredentialsIdItems

import com.cloudbees.plugins.credentials.common.StandardListBoxModel; //导入依赖的package包/类
/**
 * Stapler form completion.
 *
 * @param serverUrl the server URL.
 * @return the available credentials.
 */
@Restricted(NoExternalUse.class) // stapler
@SuppressWarnings("unused")
public ListBoxModel doFillCredentialsIdItems(@QueryParameter String serverUrl) {
    Jenkins.getActiveInstance().checkPermission(Jenkins.ADMINISTER);
    StandardListBoxModel result = new StandardListBoxModel();
    serverUrl = GiteaServers.normalizeServerUrl(serverUrl);
    result.includeMatchingAs(
            ACL.SYSTEM,
            Jenkins.getActiveInstance(),
            StandardCredentials.class,
            URIRequirementBuilder.fromUri(serverUrl).build(),
            AuthenticationTokens.matcher(GiteaAuth.class)
    );
    return result;
}
 
开发者ID:jenkinsci,项目名称:gitea-plugin,代码行数:22,代码来源:GiteaServer.java

示例2: doFillCredentialsIdItems

import com.cloudbees.plugins.credentials.common.StandardListBoxModel; //导入依赖的package包/类
public static ListBoxModel doFillCredentialsIdItems(String credentialsId) {
    if (credentialsId == null) {
        credentialsId = "";
    }

    if (!Jenkins.getInstance().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.getInstance(),
                    OpenShiftTokenCredentials.class)
            // .includeAs(ACL.SYSTEM, Jenkins.getInstance(),
            // StandardUsernamePasswordCredentials.class)
            // .includeAs(ACL.SYSTEM, Jenkins.getInstance(),
            // StandardCertificateCredentials.class)
            // TODO: Make own type for token or use the existing token
            // generator auth type used by sync plugin? or kubernetes?
            .includeCurrentValue(credentialsId);
}
 
开发者ID:openshift,项目名称:jenkins-client-plugin,代码行数:25,代码来源:ClusterConfig.java

示例3: doFillPrincipalCredentialIdItems

import com.cloudbees.plugins.credentials.common.StandardListBoxModel; //导入依赖的package包/类
public ListBoxModel doFillPrincipalCredentialIdItems(
        @AncestorInPath Item item,
        @QueryParameter String credentialsId) {
    StandardListBoxModel result = new StandardListBoxModel();
    if (item == null) {
        if (!Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER)) {
            return result.includeCurrentValue(credentialsId);
        }
    } else {
        if (!item.hasPermission(Item.EXTENDED_READ)
                && !item.hasPermission(CredentialsProvider.USE_ITEM)) {
            return result.includeCurrentValue(credentialsId);
        }
    }
    List<AzureCredentials> creds = CredentialsProvider.lookupCredentials(AzureCredentials.class, item, ACL.SYSTEM, Collections.<DomainRequirement>emptyList());
    for (AzureCredentials cred
            :
            creds) {
        result.add(cred.getId());
    }
    return result.includeEmptyValue()
            .includeCurrentValue(credentialsId);
}
 
开发者ID:jenkinsci,项目名称:azure-cli-plugin,代码行数:24,代码来源:AzureCLIBuilder.java

示例4: doFillMirrorgateCredentialsIdItems

import com.cloudbees.plugins.credentials.common.StandardListBoxModel; //导入依赖的package包/类
public ListBoxModel doFillMirrorgateCredentialsIdItems(
        @AncestorInPath Item item,
        @QueryParameter("mirrorgateCredentialsId") String credentialsId) {

    StandardListBoxModel result = new StandardListBoxModel();
    if (item == null) {
        if (!Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER)) {
            return result.includeCurrentValue(credentialsId);
        }
    } else if (!item.hasPermission(Item.EXTENDED_READ)
            && !item.hasPermission(CredentialsProvider.USE_ITEM)) {
        return result.includeCurrentValue(credentialsId);
    }
    return result
            .includeEmptyValue()
            .includeAs(ACL.SYSTEM, item, StandardUsernamePasswordCredentials.class);
}
 
开发者ID:BBVA,项目名称:mirrorgate-jenkins-builds-collector,代码行数:18,代码来源:MirrorGatePublisher.java

示例5: doFillCredentialsIdItems

import com.cloudbees.plugins.credentials.common.StandardListBoxModel; //导入依赖的package包/类
public ListBoxModel doFillCredentialsIdItems(
    @AncestorInPath Item context,
    @QueryParameter String remote,
    @QueryParameter String credentialsId) {
  if (context == null && !Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER)
      || context != null && !context.hasPermission(Item.EXTENDED_READ)) {
    return new StandardListBoxModel().includeCurrentValue(credentialsId);
  }
  return new StandardListBoxModel()
      .includeEmptyValue()
      .includeMatchingAs(
          context instanceof Queue.Task
              ? Tasks.getAuthenticationOf((Queue.Task) context)
              : ACL.SYSTEM,
          context,
          StandardUsernameCredentials.class,
          URIRequirementBuilder.fromUri(remote).build(),
          GitClient.CREDENTIALS_MATCHER)
      .includeCurrentValue(credentialsId);
}
 
开发者ID:GerritForge,项目名称:gerrit-plugin,代码行数:21,代码来源:GerritSCMSource.java

示例6: doFillCheckoutCredentialsIdItems

import com.cloudbees.plugins.credentials.common.StandardListBoxModel; //导入依赖的package包/类
@Restricted(NoExternalUse.class)
public ListBoxModel doFillCheckoutCredentialsIdItems(@AncestorInPath SCMSourceOwner context, @QueryParameter String connectionName, @QueryParameter String checkoutCredentialsId) {
    if (context == null && !Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER) ||
            context != null && !context.hasPermission(Item.EXTENDED_READ)) {
        return new StandardListBoxModel().includeCurrentValue(checkoutCredentialsId);
    }

    StandardListBoxModel result = new StandardListBoxModel();
    result.add("- anonymous -", CHECKOUT_CREDENTIALS_ANONYMOUS);
    return result.includeMatchingAs(
            context instanceof Queue.Task
                    ? Tasks.getDefaultAuthenticationOf((Queue.Task) context)
                    : ACL.SYSTEM,
            context,
            StandardUsernameCredentials.class,
            SettingsUtils.gitLabConnectionRequirements(connectionName),
            GitClient.CREDENTIALS_MATCHER
    );
}
 
开发者ID:Argelbargel,项目名称:gitlab-branch-source-plugin,代码行数:20,代码来源:GitLabSCMSourceSettings.java

示例7: doFillCredentialsIdItems

import com.cloudbees.plugins.credentials.common.StandardListBoxModel; //导入依赖的package包/类
/**
 * Fills in the Login Credentials selection box with applicable Jenkins credentials.
 * 
 * @param context
 *            filter for credentials
 * @param credentialsId
 *            existing login credentials; can be null
 * @param project
 *            the Jenkins project
 * 
 * @return credential selections
 */
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Jenkins context, @QueryParameter String credentialsId, @AncestorInPath Item project)
{
	List<StandardUsernamePasswordCredentials> creds = CredentialsProvider.lookupCredentials(
			StandardUsernamePasswordCredentials.class, project, ACL.SYSTEM,
			Collections.<DomainRequirement> emptyList());

	StandardListBoxModel model = new StandardListBoxModel();
	model.add(new Option(StringUtils.EMPTY, StringUtils.EMPTY, false));

	for (StandardUsernamePasswordCredentials c : creds)
	{
		boolean isSelected = false;
		if (credentialsId != null)
		{
			isSelected = credentialsId.matches(c.getId());
		}

		String description = Util.fixEmptyAndTrim(c.getDescription());
		model.add(new Option(c.getUsername() + (description != null ? " (" + description + ')' : StringUtils.EMPTY), //$NON-NLS-1$
				c.getId(), isSelected));
	}

	return model;
}
 
开发者ID:jenkinsci,项目名称:compuware-scm-downloader-plugin,代码行数:37,代码来源:PdsConfiguration.java

示例8: doFillCredentialsIdItems

import com.cloudbees.plugins.credentials.common.StandardListBoxModel; //导入依赖的package包/类
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item item, @QueryParameter String credentialsId) {
    StandardListBoxModel result = new StandardListBoxModel();
    if (item == null) {
        if (!Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER)) {
            return result.add(credentialsId);
        }
    } else {
        if (!item.hasPermission(Item.EXTENDED_READ)
                && !item.hasPermission(CredentialsProvider.USE_ITEM)) {
            return result.add(credentialsId);
        }
    }

    return result
            .withEmptySelection()
            .withAll(CredentialsProvider.lookupCredentials(StandardUsernamePasswordCredentials.class, item, null, Collections.<DomainRequirement>emptyList()))
            .withMatching(CredentialsMatchers.withId(credentialsId));
}
 
开发者ID:jenkinsci,项目名称:checkmarx-plugin,代码行数:19,代码来源:CxScanBuilder.java

示例9: doFillCredentialsIDItems

import com.cloudbees.plugins.credentials.common.StandardListBoxModel; //导入依赖的package包/类
public static ListBoxModel doFillCredentialsIDItems(@AncestorInPath Jenkins context) {
    if (context == null || !context.hasPermission(Item.CONFIGURE)) {
        return new StandardListBoxModel();
    }

    List<DomainRequirement> domainRequirements = new ArrayList<DomainRequirement>();
    return new StandardListBoxModel()
            .withEmptySelection()
            .withMatching(
                    CredentialsMatchers.anyOf(
                            CredentialsMatchers.instanceOf(ConduitCredentials.class)),
                    CredentialsProvider.lookupCredentials(
                            StandardCredentials.class,
                            context,
                            ACL.SYSTEM,
                            domainRequirements));
}
 
开发者ID:uber,项目名称:phabricator-jenkins-plugin,代码行数:18,代码来源:ConduitCredentialsDescriptor.java

示例10: doFillCredentialsIdItems

import com.cloudbees.plugins.credentials.common.StandardListBoxModel; //导入依赖的package包/类
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item item) {
    if (item == null && !Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER) ||
        item != null && !item.hasPermission(Item.EXTENDED_READ)) {
        return new StandardListBoxModel();
    }
    // TODO may also need to specify a specific authentication and domain requirements
    return new StandardListBoxModel()
            .withEmptySelection()
            .withMatching(AuthenticationTokens.matcher(DockerRegistryToken.class),
                    CredentialsProvider.lookupCredentials(
                            StandardCredentials.class,
                            item,
                            null,
                            Collections.<DomainRequirement>emptyList()
                    )
            );
}
 
开发者ID:jenkinsci,项目名称:docker-commons-plugin,代码行数:18,代码来源:DockerRegistryEndpoint.java

示例11: doFillCredentialsIdItems

import com.cloudbees.plugins.credentials.common.StandardListBoxModel; //导入依赖的package包/类
/**
 * Stapler helper method.
 *
 * @param context
 *            the context.
 * @param remoteBase
 *            the remote base.
 * @return list box model.
 * @throws URISyntaxException 
 */
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item context, @QueryParameter String serverAPIUrl) throws URISyntaxException {
    List<DomainRequirement> domainRequirements = URIRequirementBuilder.fromUri(serverAPIUrl).build();
    
    return new StandardListBoxModel()
            .withEmptySelection()
            .withMatching(
                    CredentialsMatchers.anyOf(
                    CredentialsMatchers.instanceOf(StandardUsernamePasswordCredentials.class),
                    CredentialsMatchers.instanceOf(StringCredentials.class)),
            CredentialsProvider.lookupCredentials(StandardCredentials.class,
                    context,
                    ACL.SYSTEM,
                    domainRequirements)
                    );
}
 
开发者ID:bratchenko,项目名称:jenkins-github-pull-request-comments,代码行数:26,代码来源:GhprcGitHubAuth.java

示例12: doFillCredentialsIdItems

import com.cloudbees.plugins.credentials.common.StandardListBoxModel; //导入依赖的package包/类
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item item, @QueryParameter String serverUrl) {
    return new StandardListBoxModel()
            .withEmptySelection()
            .withMatching(
                    CredentialsMatchers.anyOf(
                            CredentialsMatchers.instanceOf(StandardUsernamePasswordCredentials.class),
                            CredentialsMatchers.instanceOf(TokenProducer.class),
                            CredentialsMatchers.instanceOf(StandardCertificateCredentials.class)
                    ),
                    CredentialsProvider.lookupCredentials(
                            StandardCredentials.class,
                            item,
                            null,
                            URIRequirementBuilder.fromUri(serverUrl).build()
                    )
            );

}
 
开发者ID:carlossg,项目名称:jenkins-kubernetes-plugin,代码行数:19,代码来源:KubectlBuildWrapper.java

示例13: doFillCredentialsIdItems

import com.cloudbees.plugins.credentials.common.StandardListBoxModel; //导入依赖的package包/类
public ListBoxModel doFillCredentialsIdItems(@QueryParameter String serverUrl) {
    return new StandardListBoxModel().withEmptySelection() //
            .withMatching( //
                    CredentialsMatchers.anyOf(
                            CredentialsMatchers.instanceOf(StandardUsernamePasswordCredentials.class),
                            CredentialsMatchers.instanceOf(TokenProducer.class),
                            CredentialsMatchers.instanceOf(
                                    org.jenkinsci.plugins.kubernetes.credentials.TokenProducer.class),
                            CredentialsMatchers.instanceOf(StandardCertificateCredentials.class),
                            CredentialsMatchers.instanceOf(StringCredentials.class)), //
                    CredentialsProvider.lookupCredentials(StandardCredentials.class, //
                            Jenkins.getInstance(), //
                            ACL.SYSTEM, //
                            serverUrl != null ? URIRequirementBuilder.fromUri(serverUrl).build()
                                    : Collections.EMPTY_LIST //
                    ));

}
 
开发者ID:carlossg,项目名称:jenkins-kubernetes-plugin,代码行数:19,代码来源:KubernetesCloud.java

示例14: doFillApiTokenIdItems

import com.cloudbees.plugins.credentials.common.StandardListBoxModel; //导入依赖的package包/类
public ListBoxModel doFillApiTokenIdItems(@QueryParameter String name, @QueryParameter String url) {
    if (Jenkins.getInstance().hasPermission(Item.CONFIGURE)) {
        AbstractIdCredentialsListBoxModel<StandardListBoxModel, StandardCredentials> options = new StandardListBoxModel()
            .includeEmptyValue()
            .includeMatchingAs(ACL.SYSTEM,
                               Jenkins.getActiveInstance(),
                               StandardCredentials.class,
                               URIRequirementBuilder.fromUri(url).build(),
                               new GitLabCredentialMatcher());
        if (name != null && connectionMap.containsKey(name)) {
            String apiTokenId = connectionMap.get(name).getApiTokenId();
            options.includeCurrentValue(apiTokenId);
            for (ListBoxModel.Option option : options) {
                if (option.value.equals(apiTokenId)) {
                    option.selected = true;
                }
            }
        }
        return options;
    }
    return new StandardListBoxModel();
}
 
开发者ID:jenkinsci,项目名称:gitlab-plugin,代码行数:23,代码来源:GitLabConnectionConfig.java

示例15: doFillCredentialItems

import com.cloudbees.plugins.credentials.common.StandardListBoxModel; //导入依赖的package包/类
@SuppressFBWarnings(value="NP_NULL_PARAM_DEREF", justification="pending https://github.com/jenkinsci/credentials-plugin/pull/68")
static public ListBoxModel doFillCredentialItems(Item project, String credentialsId) {

	if(project == null && !Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER) ||
			project != null && !project.hasPermission(Item.EXTENDED_READ)) {
		return new StandardListBoxModel().includeCurrentValue(credentialsId);
	}

	return new StandardListBoxModel()
			.includeEmptyValue()
			.includeMatchingAs(
					project instanceof Queue.Task
							? Tasks.getAuthenticationOf((Queue.Task) project)
							: ACL.SYSTEM,
					project,
					P4BaseCredentials.class,
					Collections.<DomainRequirement>emptyList(),
					CredentialsMatchers.instanceOf(P4BaseCredentials.class));
}
 
开发者ID:p4paul,项目名称:p4-jenkins,代码行数:20,代码来源:P4CredentialsImpl.java


注:本文中的com.cloudbees.plugins.credentials.common.StandardListBoxModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。