@Override public GlobalCredentialsConfiguration getTargetComponent(ConfigurationContext context) { return GlobalCredentialsConfiguration.all().get(GlobalCredentialsConfiguration.class); }
/** * Handles the form submission * * @param req the request. * @return the response. * @throws IOException if something goes wrong. * @throws ServletException if something goes wrong. * @throws FormException if something goes wrong. */ @RequirePOST @NonNull @Restricted(NoExternalUse.class) @SuppressWarnings("unused") // stapler web method binding public synchronized HttpResponse doConfigure(@NonNull StaplerRequest req) throws IOException, ServletException, FormException { Jenkins jenkins = Jenkins.getActiveInstance(); jenkins.checkPermission(Jenkins.ADMINISTER); // logically this change starts from Jenkins BulkChange bc = new BulkChange(jenkins); try { boolean result = configure(req, req.getSubmittedForm()); LOGGER.log(Level.FINE, "credentials configuration saved: " + result); jenkins.save(); return FormApply .success(result ? req.getContextPath() + "/manage" : req.getContextPath() + "/" + getUrlName()); } finally { bc.commit(); } }
/** * {@inheritDoc} */ @Override public String getDisplayName() { return getDescriptor().getDisplayName(); }
/** * Performs the configuration. * * @param req the request. * @param json the JSON object. * @return {@code false} to keep the client in the same config page. * @throws FormException if something goes wrong. */ private boolean configure(StaplerRequest req, JSONObject json) throws FormException { // for compatibility reasons, the actual value is stored in Jenkins Jenkins j = Jenkins.getActiveInstance(); j.checkPermission(Jenkins.ADMINISTER); // persist all the provider configs boolean result = true; for (Descriptor<?> d : Functions.getSortedDescriptorsForGlobalConfig(FILTER)) { result &= configureDescriptor(req, json, d); } return result; }
/** * Handles the form submission * * @param req the request. * @return the response. * @throws IOException if something goes wrong. * @throws ServletException if something goes wrong. * @throws FormException if something goes wrong. */ @RequirePOST @NonNull @Restricted(NoExternalUse.class) @SuppressWarnings("unused") // stapler web method binding public synchronized HttpResponse doConfigure(@NonNull StaplerRequest req) throws IOException, ServletException, FormException { Jenkins jenkins = Jenkins.getActiveInstance(); jenkins.checkPermission(Jenkins.ADMINISTER); // logically this change starts from Jenkins BulkChange bc = new BulkChange(jenkins); try { boolean result = configure(req, req.getSubmittedForm()); LOGGER.log(Level.FINE, "credentials configuration saved: " + result); jenkins.save(); return FormApply .success(result ? req.getContextPath() + "/manage" : req.getContextPath() + "/" + getUrlName()); } finally { bc.commit(); } }
/** * {@inheritDoc} */ @Override public String getDisplayName() { return getDescriptor().getDisplayName(); }
/** * Performs the configuration. * * @param req the request. * @param json the JSON object. * @return {@code false} to keep the client in the same config page. * @throws FormException if something goes wrong. */ private boolean configure(StaplerRequest req, JSONObject json) throws FormException { // for compatibility reasons, the actual value is stored in Jenkins Jenkins j = Jenkins.getActiveInstance(); j.checkPermission(Jenkins.ADMINISTER); // persist all the provider configs boolean result = true; for (Descriptor<?> d : Functions.getSortedDescriptorsForGlobalConfig(FILTER)) { result &= configureDescriptor(req, json, d); } return result; }