Class ApproverInput
The field is the repeated approvers (one user id per value), which is what the
rendered checkbox picker posts. For scripts written against the single-approver contract the
old approver field is still read and merged in. When a form arrives only as a
json blob (as getSubmittedForm reads it), approvers may be a string or
an array of strings there.
A multipart/form-data body (the Request Run form, D-72) keeps only the last part of
a repeated field in Stapler, so there the json blob the form posts with it is read as
instead (RepeatedField): the rendered checkboxes put the checked ids into it in order,
and when it holds ids they are the whole set (the raw part, which Stapler decodes as ISO-8859-1
without a part charset, is then not read). Without ids in the blob the raw part is used.
Validation here is shape only: entries are trimmed, blanks dropped, duplicates collapsed, and the count and length are bounded so a request cannot carry unbounded input. Eligibility (listed approver, not the requester, job restriction) stays in the policy layer.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringField name of the repeated approver field.static final StringField name of the single-approver field accepted for compatibility.static final intUpper bound on the number of designated approvers in one submission.static final intUpper bound on one user id. -
Method Summary
-
Field Details
-
MAX_APPROVERS
public static final int MAX_APPROVERSUpper bound on the number of designated approvers in one submission.- See Also:
-
MAX_USER_ID_LENGTH
public static final int MAX_USER_ID_LENGTHUpper bound on one user id.- See Also:
-
FIELD
Field name of the repeated approver field.- See Also:
-
LEGACY_FIELD
Field name of the single-approver field accepted for compatibility.- See Also:
-
-
Method Details
-
read
public static List<String> read(org.kohsuke.stapler.StaplerRequest2 req, @CheckForNull net.sf.json.JSONObject formData) - Parameters:
req- the current requestformData- the parsedjsonblob when the form carried one, otherwisenull(for a multipart request the blob is then read from the request when it carries one)- Returns:
- the trimmed, de-duplicated approver ids in submission order, possibly empty (the service then refuses the request with its own message)
- Throws:
Failure- when the input exceeds the count or length bounds
-