/** * {@inheritDoc} */ @Override protected int run() throws Exception { store.checkPermission(CredentialsProvider.UPDATE); Domain domain = getDomainByName(store, this.domain); if (domain == null) { stderr.println("No such domain"); return 2; } Items.XSTREAM2.toXML(domain, new OutputStreamWriter(stdout, "UTF-8")); return 0; }
/** * {@inheritDoc} */ @Override protected int run() throws Exception { store.checkPermission(CredentialsProvider.UPDATE); Domain domain = getDomainByName(store, this.domain); if (domain == null) { stderr.println("No such domain"); return 2; } Items.XSTREAM2.toXML(domain, new OutputStreamWriter(stdout, "UTF-8")); return 0; }
/** * {@inheritDoc} */ @Override protected int run() throws Exception { store.checkPermission(CredentialsProvider.MANAGE_DOMAINS); Domain domain = getDomainByName(store, this.domain); if (domain == null) { stderr.println("No such domain"); return 2; } if (store.removeDomain(domain)) { return 0; } stderr.println("Not deleted"); return 1; }
/** * {@inheritDoc} */ @Override protected int run() throws Exception { store.checkPermission(CredentialsProvider.MANAGE_DOMAINS); Domain domain = getDomainByName(store, this.domain); if (domain == null) { stderr.println("No such domain"); return 2; } if (store.removeDomain(domain)) { return 0; } stderr.println("Not deleted"); return 1; }
@Override protected int run() throws Exception { store.checkPermission(CredentialsProvider.UPDATE); List<DomainCredentials> existing = new ArrayList<>(); List<Domain> domains = store.getDomains(); for (Domain domain : domains) { existing.add(new DomainCredentials(domain, store.getCredentials(domain))); } CredentialsStoreAction.SECRETS_REDACTED.toXML(existing, new OutputStreamWriter(stdout, "UTF-8")); return 0; }
/** * {@inheritDoc} */ @Override protected int run() throws Exception { store.checkPermission(CredentialsProvider.UPDATE); Domain domain = getDomainByName(store, this.domain); if (domain == null) { stderr.println("No such domain"); return 2; } Credentials existing = getCredentialsById(store, domain, id); if (existing == null) { stderr.println("No such credential"); return 3; } CredentialsStoreAction.SECRETS_REDACTED.toXML(existing, new OutputStreamWriter(stdout, "UTF-8")); return 0; }
/** * {@inheritDoc} */ @Override protected int run() throws Exception { store.checkPermission(CredentialsProvider.UPDATE); Domain domain = getDomainByName(store, this.domain); if (domain == null) { stderr.println("No such domain"); return 2; } Credentials existing = getCredentialsById(store, domain, id); if (existing == null) { stderr.println("No such credential"); return 3; } CredentialsStoreAction.SECRETS_REDACTED.toXML(existing, new OutputStreamWriter(stdout, "UTF-8")); return 0; }
/** * {@inheritDoc} */ @Override protected int run() throws Exception { store.checkPermission(CredentialsProvider.MANAGE_DOMAINS); Domain domain = (Domain) Items.XSTREAM.unmarshal(safeXmlStreamReader(stdin)); if (store.addDomain(domain)) { return 0; } stderr.println("No change"); return 1; } }
@Override protected int run() throws Exception { store.checkPermission(CredentialsProvider.CREATE); store.checkPermission(CredentialsProvider.MANAGE_DOMAINS); List<DomainCredentials> replacement = (List<DomainCredentials>) Items.XSTREAM.unmarshal(safeXmlStreamReader(stdin)); for (DomainCredentials domain : replacement) { for (Credentials credentials : domain.getCredentials()) { store.addDomain(domain.getDomain(), credentials); } } return 0; }
/** * {@inheritDoc} */ @Override protected int run() throws Exception { store.checkPermission(CredentialsProvider.DELETE); Domain domain = getDomainByName(store, this.domain); if (domain == null) { stderr.println("No such domain"); return 2; } Credentials existing = getCredentialsById(store, domain, id); if (existing == null) { stderr.println("No such credential"); return 3; } if (store.removeCredentials(domain, existing)) { return 0; } stderr.println("Not deleted"); return 1; }
/** * {@inheritDoc} */ @Override protected int run() throws Exception { store.checkPermission(CredentialsProvider.MANAGE_DOMAINS); Domain domain = (Domain) Items.XSTREAM.unmarshal(safeXmlStreamReader(stdin)); if (store.addDomain(domain)) { return 0; } stderr.println("No change"); return 1; } }
/** * {@inheritDoc} */ @Override protected int run() throws Exception { store.checkPermission(CredentialsProvider.CREATE); Domain domain = getDomainByName(store, this.domain); if (domain == null) { stderr.println("No such domain"); return 2; } Credentials credentials = (Credentials) Items.XSTREAM.unmarshal(safeXmlStreamReader(stdin)); if (store.addCredentials(domain, credentials)) { return 0; } stderr.println("No change"); return 1; } }
/** * {@inheritDoc} */ @Override protected int run() throws Exception { store.checkPermission(CredentialsProvider.MANAGE_DOMAINS); Domain domain = getDomainByName(store, this.domain); if (domain == null) { stderr.println("No such domain"); return 2; } Domain replacement = (Domain) Items.XSTREAM.unmarshal(safeXmlStreamReader(stdin)); if (store.updateDomain(domain, replacement)) { return 0; } stderr.println("No change"); return 1; } }
/** * {@inheritDoc} */ @Override protected int run() throws Exception { store.checkPermission(CredentialsProvider.CREATE); Domain domain = getDomainByName(store, this.domain); if (domain == null) { stderr.println("No such domain"); return 2; } Credentials credentials = (Credentials) Items.XSTREAM.unmarshal(safeXmlStreamReader(stdin)); if (store.addCredentials(domain, credentials)) { return 0; } stderr.println("No change"); return 1; } }
/** * {@inheritDoc} */ @Override protected int run() throws Exception { store.checkPermission(CredentialsProvider.MANAGE_DOMAINS); Domain domain = getDomainByName(store, this.domain); if (domain == null) { stderr.println("No such domain"); return 2; } Domain replacement = (Domain) Items.XSTREAM.unmarshal(safeXmlStreamReader(stdin)); if (store.updateDomain(domain, replacement)) { return 0; } stderr.println("No change"); return 1; } }
/** * Deletes the credentials. * * @param req the request. * @return the response. * @throws IOException if something goes wrong. */ @RequirePOST @Restricted(NoExternalUse.class) @SuppressWarnings("unused") // stapler web method public HttpResponse doDoDelete(StaplerRequest req) throws IOException { getStore().checkPermission(DELETE); if (getStore().removeCredentials(domain.getDomain(), credentials)) { return HttpResponses.redirectTo("../.."); } return HttpResponses.redirectToDot(); }
/** * Deletes the credentials. * * @param req the request. * @return the response. * @throws IOException if something goes wrong. */ @RequirePOST @Restricted(NoExternalUse.class) @SuppressWarnings("unused") // stapler web method public HttpResponse doDoDelete(StaplerRequest req) throws IOException { getStore().checkPermission(DELETE); if (getStore().removeCredentials(domain.getDomain(), credentials)) { return HttpResponses.redirectTo("../.."); } return HttpResponses.redirectToDot(); }
/** * Updates the credentials. * * @param req the request. * @return the response. * @throws ServletException if something goes wrong. * @throws IOException if something goes wrong. */ @RequirePOST @Restricted(NoExternalUse.class) @SuppressWarnings("unused") // stapler web method public HttpResponse doUpdateSubmit(StaplerRequest req) throws ServletException, IOException { getStore().checkPermission(UPDATE); JSONObject data = req.getSubmittedForm(); Credentials credentials = req.bindJSON(Credentials.class, data); if (!getStore().updateCredentials(this.domain.domain, this.credentials, credentials)) { return HttpResponses.redirectTo("concurrentModification"); } return HttpResponses.redirectToDot(); }
/** * Updates the credentials. * * @param req the request. * @return the response. * @throws ServletException if something goes wrong. * @throws IOException if something goes wrong. */ @RequirePOST @Restricted(NoExternalUse.class) @SuppressWarnings("unused") // stapler web method public HttpResponse doUpdateSubmit(StaplerRequest req) throws ServletException, IOException { getStore().checkPermission(UPDATE); JSONObject data = req.getSubmittedForm(); Credentials credentials = req.bindJSON(Credentials.class, data); if (!getStore().updateCredentials(this.domain.domain, this.credentials, credentials)) { return HttpResponses.redirectTo("concurrentModification"); } return HttpResponses.redirectToDot(); }
/** * Deletes a domain. * * @param req the request. * @return the response. * @throws IOException if something goes wrong. */ @RequirePOST @Restricted(NoExternalUse.class) @SuppressWarnings("unused") // stapler web method public HttpResponse doDoDelete(StaplerRequest req) throws IOException { if (!getStore().isDomainsModifiable()) { return HttpResponses.status(400); } getStore().checkPermission(MANAGE_DOMAINS); if (getStore().removeDomain(domain)) { return HttpResponses.redirectTo("../.."); } return HttpResponses.redirectToDot(); }