/** Accepts submission from the configuration page. */ public void doConfigSubmit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, FormException { checkPermission(Hudson.ADMINISTER); fullName = req.getParameter("fullName"); description = req.getParameter("description"); JSONObject json = req.getSubmittedForm(); List<UserProperty> props = new ArrayList<UserProperty>(); int i = 0; for (UserPropertyDescriptor d : UserProperty.all()) { UserProperty p = getProperty(d.clazz); JSONObject o = json.optJSONObject("userProperty" + (i++)); if (o != null) { if (p != null) { p = p.reconfigure(req, o); } else { p = d.newInstance(req, o); } p.setUser(this); } if (p != null) props.add(p); } this.properties = props; save(); rsp.sendRedirect("."); }
/** Accepts the new description. */ public synchronized void doSubmitDescription(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { checkPermission(Hudson.ADMINISTER); description = req.getParameter("description"); save(); rsp.sendRedirect("."); // go to the top page }
/** Deletes this user from Hudson. */ public void doDoDelete(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { requirePOST(); checkPermission(Hudson.ADMINISTER); if (id.equals(Hudson.getAuthentication().getName())) { rsp.sendError(HttpServletResponse.SC_BAD_REQUEST, "Cannot delete self"); return; } delete(); rsp.sendRedirect2("../.."); }