Class SectionAccess
java.lang.Object
io.jenkins.plugins.batchcontrol.ui.SectionAccess
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
public final class SectionAccess
extends Object
The permissions each Batch Control screen requires, in one place (SPEC item 2, hosting
review).
The same arrays feed three things, so they cannot drift apart:
- the section gates (
getTarget()of each section), which answer 403; - the
permissionsattribute of each screen'sl:layout; - the link predicates of an instance (
isRequests()and friends), which decide whether a sidebar entry or an in-page link to a screen is rendered at all.
Every method returns a fresh array: callers (and Jelly) may not mutate the shared definition.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Permission[]/batch-control/activations/**: requesters, approvers and managers hold it on Jenkins; since D-38c the section also opens for every other user admitted to the root (canOpenActivations()).static Permission[]Any Batch Control permission: without one of these the whole root action is absent.static booleanD-38c (amends D-38b): whether the current user may open the Activations screen: every user admitted to the Batch Control root page.static booleanD-38b: whether the current user may open the Run Requests screen: one ofrequests()on Jenkins, or run requests of their own to see (Request held only on some jobs or folders).static booleanD-38b: whether the Batch Control root action exists for the current user.booleanWhether the grant request (or the grant, which has the same id) with this id may be linked (DEF-11): the Grants screen is open to the user AND the request is visible to them (P-09).static Permission[]grants()/batch-control/grants/**: grant requesters, approvers and managers.static booleanhasAny(Permission[] permissions) Whether the current user holds at least one ofpermissionson Jenkins.static Permission[]history()Changes, dashboard, incidents and history:ViewHistory.booleanWhether the Activations screen (and its detail pages) may be linked for this user.booleanisGrants()Whether the Grants screen may be linked: the permission gate, and change control on (the subtree refuses every request while it is off, P-15).booleanWhether the ViewHistory screens (changes, dashboard, incidents, history) may be linked.booleanWhether the Run Requests screen (and its detail pages) may be linked for this user.booleanWhether the run request with this id may be linked (e2e-03 DEF-11): the Run Requests screen is open to the user AND the request itself is visible to them (P-09,Visibility.canSeeRunRequest(io.jenkins.plugins.batchcontrol.model.RunRequest)); the detail page answers 404 otherwise.static Permission[]requests()/batch-control/requests/**: requesters, approvers and managers.static Permission[]viewPermissions(Permission[] permissions, boolean admitted) Thel:layoutpermissions of a screen whose gate admits a user throughhasOwnas well as throughpermissions:permissionsfor a holder of one of them, and none (the gate has already admitted the user) for a user who is there only for requests of their own, whom the Jenkins-level check would refuse.
-
Constructor Details
-
SectionAccess
public SectionAccess()
-
-
Method Details
-
anyPermission
Any Batch Control permission: without one of these the whole root action is absent. -
requests
/batch-control/requests/**: requesters, approvers and managers. -
activations
/batch-control/activations/**: requesters, approvers and managers hold it on Jenkins; since D-38c the section also opens for every other user admitted to the root (canOpenActivations()). An activation request needsBatchControl/Request(D-39) and is decided withBatchControl/Approve, like a run request. -
grants
/batch-control/grants/**: grant requesters, approvers and managers. -
history
Changes, dashboard, incidents and history:ViewHistory. -
hasAny
Whether the current user holds at least one ofpermissionson Jenkins. -
canOpenRequests
public static boolean canOpenRequests()D-38b: whether the current user may open the Run Requests screen: one ofrequests()on Jenkins, or run requests of their own to see (Request held only on some jobs or folders). The own-requests test is the service's index lookup, never a scan of all items. -
canOpenActivations
public static boolean canOpenActivations()D-38c (amends D-38b): whether the current user may open the Activations screen: every user admitted to the Batch Control root page. The rows stay limited by the visibility rules (possibly none), and requesting an activation is still checked on the job. No scan of all items. -
canOpenRoot
public static boolean canOpenRoot()D-38b: whether the Batch Control root action exists for the current user. -
viewPermissions
Thel:layoutpermissions of a screen whose gate admits a user throughhasOwnas well as throughpermissions:permissionsfor a holder of one of them, and none (the gate has already admitted the user) for a user who is there only for requests of their own, whom the Jenkins-level check would refuse. -
isRequests
public boolean isRequests()Whether the Run Requests screen (and its detail pages) may be linked for this user. -
isActivations
public boolean isActivations()Whether the Activations screen (and its detail pages) may be linked for this user. -
isGrants
public boolean isGrants()Whether the Grants screen may be linked: the permission gate, and change control on (the subtree refuses every request while it is off, P-15). -
isHistory
public boolean isHistory()Whether the ViewHistory screens (changes, dashboard, incidents, history) may be linked. -
request
Whether the run request with this id may be linked (e2e-03 DEF-11): the Run Requests screen is open to the user AND the request itself is visible to them (P-09,Visibility.canSeeRunRequest(io.jenkins.plugins.batchcontrol.model.RunRequest)); the detail page answers 404 otherwise. Rows of the history screens are visible to every ViewHistory holder, so the id is then plain text. -
grant
Whether the grant request (or the grant, which has the same id) with this id may be linked (DEF-11): the Grants screen is open to the user AND the request is visible to them (P-09).
-