public FormValidation doCheckCredentialsId(@CheckForNull @AncestorInPath Item item, @QueryParameter String credentialsId, @QueryParameter String serverUrl) { if (item == null) { if (!Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER)) { return FormValidation.ok(); } } else if (!item.hasPermission(Item.EXTENDED_READ) && !item.hasPermission(CredentialsProvider.USE_ITEM)) { return FormValidation.ok(); } if (StringUtils.isBlank(credentialsId)) { return FormValidation.warning(Messages.NPMRegistry_DescriptorImpl_emptyCredentialsId()); } List<DomainRequirement> domainRequirement = URIRequirementBuilder.fromUri(serverUrl).build(); if (CredentialsProvider.listCredentials(StandardUsernameCredentials.class, item, getAuthentication(item), domainRequirement, CredentialsMatchers.withId(credentialsId)).isEmpty()) { return FormValidation.error(Messages.NPMRegistry_DescriptorImpl_invalidCredentialsId()); } return FormValidation.ok(); }
/** * Set the selected server. * * @param name the name of the newly selected server. * */ @DataBoundSetter public void setServerName(String name) { this.serverName = name; if (this.notificationLevel == null) { ListBoxModel options = ((DescriptorImpl)getDescriptor()).doFillNotificationLevelItems(this.serverName); if (!options.isEmpty()) { notificationLevel = options.get(0).value; } } }
/** * Returns all registered Groovy parsers. These are packed into a {@link ListBoxModel} in order to show them in * the list box of the config.jelly view part. * * @return the model of the list box */ @SuppressWarnings("unused") // Called from config.jelly public ListBoxModel doFillParserIdItems() { ListBoxModel options = ParserConfiguration.getInstance().asListBoxModel(); if (options.isEmpty()) { return options.add(Messages.Warnings_Groovy_NoParsersDefined()); } return options; } }
AuthenticationTokens.matcher(GiteaAuth.class) )).isEmpty()) { return FormValidation.error(Messages.GiteaSCMSource_selectedCredentialsMissing());
if (descriptor != null) { ListBoxModel options = descriptor.doFillNotificationLevelItems(this.serverName); if (!options.isEmpty()) { this.notificationLevel = options.get(0).value;
AuthenticationTokens.matcher(GiteaAuth.class) )).isEmpty()) { return FormValidation.error(Messages.GiteaSCMNavigator_selectedCredentialsMissing());
if (result.isEmpty()) { result.add(repository);