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(); }
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath ItemGroup context, @QueryParameter String value) { AccessControlled ac = (context instanceof AccessControlled ? (AccessControlled) context : Jenkins.getInstance()); if (!ac.hasPermission(Jenkins.ADMINISTER)) { return new StandardListBoxModel().includeCurrentValue(value); } return new StandardListBoxModel().includeAs( ACL.SYSTEM, context, DockerServerCredentials.class, Collections.<DomainRequirement>emptyList()); }
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item owner) { // when configuring the job, you only want those credentials that are available to ACL.SYSTEM selectable // as we cannot select from a user's credentials unless they are the only user submitting the build // (which we cannot assume) thus ACL.SYSTEM is correct here. return new StandardListBoxModel().withAll( CredentialsProvider.lookupCredentials( StandardUsernamePasswordCredentials.class, owner, ACL.SYSTEM, Collections.<DomainRequirement>emptyList())); }
/** * Fills the webHook name input. * @return */ public ListBoxModel doFillWebHookNameItems() { StandardListBoxModel listBoxModel = new StandardListBoxModel(); for (ReleaseWebHook webHook : ReleaseWebHookHelper.getReleaseWebHookConfigurations()) { listBoxModel.add(webHook.getWebHookName()); } return listBoxModel; } }
public ListBoxModel doFillSshCredentialIdItems(@AncestorInPath Item owner) { StandardListBoxModel model = new StandardListBoxModel(); model.includeEmptyValue(); model.includeAs(ACL.SYSTEM, owner, StandardUsernameCredentials.class); return model; } }
public ListBoxModel doFillDockerRegistryCredentialsItems(@AncestorInPath Item item, @QueryParameter String uri) { return new StandardListBoxModel() .withEmptySelection() .withMatching(AuthenticationTokens.matcher(DockerRegistryToken.class), CredentialsProvider.lookupCredentials( StandardCredentials.class, item, null, Collections.<DomainRequirement>emptyList() ) ); }
public ListBoxModel doFillKubeconfigIdItems(@AncestorInPath Item owner) { StandardListBoxModel model = new StandardListBoxModel(); model.includeEmptyValue(); model.includeAs(ACL.SYSTEM, owner, KubeconfigCredentials.class); return model; }
public ListBoxModel doFillCredentialsIdItems() { return new StandardListBoxModel() .withEmptySelection() .withMatching( CredentialsMatchers.always(), CredentialsProvider.lookupCredentials(AmazonWebServicesCredentials.class, Jenkins.getInstance(), ACL.SYSTEM, Collections.emptyList())); } }
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item context, @QueryParameter String tagsDir) { if (context == null || !context.hasPermission(Item.EXTENDED_READ)) { return new StandardListBoxModel(); } return Jenkins.getInstance().getDescriptorByType( SubversionSCM.ModuleLocation.DescriptorImpl.class).fillCredentialsIdItems(context, tagsDir); }
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item context, @QueryParameter String remote) { if (context == null && !Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER) || context != null && !context.hasPermission(Item.EXTENDED_READ)) { return new StandardListBoxModel(); } return fillCredentialsIdItems(context, remote); }
public ListBoxModel doFillAzureCredentialsIdItems(@AncestorInPath Item owner) { return new StandardListBoxModel() .includeEmptyValue() .withAll(CredentialsProvider.lookupCredentials(AzureCredentials.class, owner, ACL.SYSTEM, Collections.<DomainRequirement>emptyList())) .withAll(CredentialsProvider.lookupCredentials(AzureMsiCredentials.class, owner, ACL.SYSTEM, Collections.<DomainRequirement>emptyList())); }
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath ItemGroup context) { List<DockerRegistryAuthCredentials> credentials = CredentialsProvider.lookupCredentials(DockerRegistryAuthCredentials.class, context, ACL.SYSTEM, Collections.emptyList()); return new StandardListBoxModel().withEmptySelection() .withMatching(CredentialsMatchers.instanceOf(DockerRegistryAuthCredentials.class), credentials); } }
public ListBoxModel doFillCredentialsIdItems(@CheckForNull @AncestorInPath Item context, @QueryParameter String apiUri, @QueryParameter String credentialsId) { if (context == null ? !Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER) : !context.hasPermission(Item.EXTENDED_READ)) { return new StandardListBoxModel().includeCurrentValue(credentialsId); } return Connector.listScanCredentials(context, apiUri); }
public static ListBoxModel doFillCredentialsIdItems(ItemGroup context) { return new StandardListBoxModel() .withEmptySelection() .withMatching( CredentialsMatchers.always(), CredentialsProvider.lookupCredentials(AmazonWebServicesCredentials.class, context, ACL.SYSTEM, Collections.EMPTY_LIST)); } }
@SuppressWarnings("unused") @Restricted(NoExternalUse.class) public final ListBoxModel doFillBuildStatusPublishModeItems() { StandardListBoxModel result = new StandardListBoxModel(); for (BuildStatusPublishMode mode : BuildStatusPublishMode.values()) { result.add(mode.name()); } return result; } }
@Restricted(DoNotUse.class) // Stapler only. @SuppressWarnings("unused") // Used by stapler. @RequirePOST public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item item, @QueryParameter String master) { Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER); List<DomainRequirement> domainRequirements = (master == null) ? Collections.<DomainRequirement>emptyList() : URIRequirementBuilder.fromUri(master.trim()).build(); return new StandardListBoxModel().withEmptySelection().withMatching( CredentialsMatchers.instanceOf(UsernamePasswordCredentials.class), CredentialsProvider.lookupCredentials(StandardUsernamePasswordCredentials.class, item, null, domainRequirements) ); }
public ListBoxModel doFillSshCredentialsIdItems(@AncestorInPath Item owner) { StandardListBoxModel model = new StandardListBoxModel(); model.add(Messages.SSHCredentials_selectCredentials(), Constants.INVALID_OPTION); model.includeAs(ACL.SYSTEM, owner, SSHUserPrivateKey.class); model.includeAs(ACL.SYSTEM, owner, StandardUsernamePasswordCredentials.class); return model; }
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item item) { return new StandardListBoxModel().withEmptySelection().withMatching( CredentialsMatchers.anyOf( CredentialsMatchers.instanceOf(StringCredentials.class), CredentialsMatchers.instanceOf(UsernamePasswordCredentials.class) ), CredentialsProvider.lookupCredentials(StandardCredentials.class, item, null, Collections.<DomainRequirement>emptyList()) ); }
/** * This method is called to populate the credentials list on the Jenkins * config page. */ public ListBoxModel doFillCredentialsIdItems(@AncestorInPath ItemGroup context, @QueryParameter("target") final String target) { StandardListBoxModel result = new StandardListBoxModel(); result.includeEmptyValue(); result.withMatching(CredentialsMatchers.instanceOf(StandardCredentials.class), CredentialsProvider.lookupCredentials(StandardCredentials.class, context, ACL.SYSTEM, URIRequirementBuilder.fromUri(target).build())); return result; }
public static ListBoxModel doFillCredentialsIdItems(String endpointUrl) { return new StandardListBoxModel() .withEmptySelection() .withMatching( CredentialsMatchers.anyOf(CredentialsMatchers.instanceOf(TokenCredentialsImpl.class), CredentialsMatchers.instanceOf(UsernamePasswordCredentials.class)), CredentialsProvider.lookupCredentials(StandardCredentials.class, Jenkins.getInstance(), ACL.SYSTEM, URIRequirementBuilder.fromUri(endpointUrl).build())); }