Class Visibility
Read-only: only public model getters, findVisibleJob(java.lang.String) / findVisibleItem(java.lang.String)
and hasPermission are used. State-changing endpoints keep their own permission
checks — nothing here replaces them.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancanSeeActivationRequest(ActivationRequest request) An activation or hold request is visible iff the caller has Manage, or is the requester or a member of the designated approver set (P-09, SPEC item 6a).static booleancanSeeGrant(Grant grant) An active grant is visible iff the caller has Manage, or the grant is their own.static booleancanSeeGrantRequest(GrantRequest request) A grant request is visible iff the caller has Manage, or is the requester or a member of the designated approver set (D-37).static booleancanSeeRunRequest(RunRequest request) A run request is visible iff the caller has Manage (or Overall/Administer), OR is the requester, OR is a member of the designated approver set (D-37), OR holds Item/Read on the target job.static ItemfindVisibleItem(String fullName) TheItemform offindVisibleJob(java.lang.String), for call sites that accept folders too.static Job<?, ?> findVisibleJob(String fullName) Resolves a job by full name for display purposes, treating "the caller may not see it" exactly like "it does not exist" (S-16).static StringThe one run-link rule of every Batch Control screen (D-44): a run links to its build page only when the viewer holdsItem/Readon the job; otherwise the view renders the run as plain text, and a build that has been deleted since is plain text too (e2e-03 DEF-23).static StringrunUrlFromRunId(String runId) runUrl(String, int)for a stored run id of the formjobFullName#number.
-
Method Details
-
findVisibleJob
Resolves a job by full name for display purposes, treating "the caller may not see it" exactly like "it does not exist" (S-16).Jenkins.getItemByFullNameis permission-aware but it does not report an invisible item by returningnull: when the caller holdsItem/Discoverand notItem/Read, core throwsAccessDeniedException(that is howItem/Discoveris specified — "the item exists, log in to see it"). Only a caller with neither permission getsnull.Letting that exception escape a Jelly-facing getter is worse than a 403: Jenkins' JEXL evaluator catches it and resolves the whole expression to
null, so the page still answers HTTP 200 while the row list comes back empty and the record count renders as a blank. One request filed against a discover-only job then wipes out every other row on/batch-control/requests/, including the caller's own, and nothing anywhere tells the caller that anything was withheld. A user who cannot see their own request concludes it was never filed.So every display-time lookup funnels through here instead, and a discover-only job is treated exactly like an invisible or deleted one: that row drops out and the rest of the screen renders normally. The disclosure boundary is unchanged — nothing is shown that
Item/Readwould not have shown — and the side effect of the old behaviour (roughly 190 log lines per swallowed lookup) disappears with it.- Parameters:
fullName- the job's full name as stored on the record, possiblynull- Returns:
- the job, or
nullwhen it does not exist, is not aJob, or is not visible to the caller
-
findVisibleItem
TheItemform offindVisibleJob(java.lang.String), for call sites that accept folders too.- Parameters:
fullName- the item's full name, possiblynull- Returns:
- the item, or
nullwhen it does not exist or is not visible to the caller
-
runUrl
The one run-link rule of every Batch Control screen (D-44): a run links to its build page only when the viewer holdsItem/Readon the job; otherwise the view renders the run as plain text, and a build that has been deleted since is plain text too (e2e-03 DEF-23). The history screens follow it too: they stay outside the P-09 record-visibility boundary (S-12, everyViewHistoryholder sees every row), but a link to a job the viewer cannot read would only advertise the job's URL and answer 404.- Returns:
- the root-relative build URL, the run's own
Run.getUrl()(job/a/job/b/12/,job/mx/X=a/1/for a matrix configuration), ornullfor plain text
-
runUrlFromRunId
runUrl(String, int)for a stored run id of the formjobFullName#number.- Returns:
- the root-relative build URL, or
nullwhen the id is malformed or the viewer may not read the job (the view then renders the id as plain text)
-
canSeeRunRequest
A run request is visible iff the caller has Manage (or Overall/Administer), OR is the requester, OR is a member of the designated approver set (D-37), OR holds Item/Read on the target job. When the job no longer exists — or is invisible to the caller, including the discover-only case handled byfindVisibleJob(java.lang.String)— only requester/approver/Manage still see it. -
canSeeGrantRequest
A grant request is visible iff the caller has Manage, or is the requester or a member of the designated approver set (D-37). -
canSeeActivationRequest
An activation or hold request is visible iff the caller has Manage, or is the requester or a member of the designated approver set (P-09, SPEC item 6a). Unlike a run request,Item/Readon the job does not make it visible: the request carries the approver set and the reason, which the job page does not otherwise disclose. -
canSeeGrant
An active grant is visible iff the caller has Manage, or the grant is their own.
-