Class BatchControlStrategyMonitor
- All Implemented Interfaces:
ExtensionPoint,ModelObject,SearchableModelObject,SearchItem,org.kohsuke.stapler.StaplerProxy
It also warns while change control is on and no build authenticator is configured, so builds
run as SYSTEM (D-35d (2), isBuildAuthenticatorMissing()).
doMigrate() (the "Install the Batch Control variant" button, POST and
Overall/Administer only) is the only path that converts a plain strategy; nothing converts one
on load (D-35e). It copies an installed plain matrix-auth matrix (project-based, or global:
then per-item properties become effective, isPerItemWidening()) or role-strategy
configuration into the matching Batch Control subclass, keeping every entry; doRevert()
is the reverse, the uninstall path. Neither touches per-item properties, which live on the
items. Neither switches to ACL.SYSTEM2: an administrator runs them and
Jenkins.save() needs no further permission.
Both actions work whether or not the monitor is activated: its URL
(/manage/administrativeMonitor/batch-control-strategy/) only requires Overall/Administer,
and the revert button lives on the Batch Control global configuration page, where a Batch
Control strategy is installed and the monitor is therefore quiet. After success both redirect
back to the referring page of this Jenkins, or to the global security page.
matrix-auth and role-strategy are optional: this class refers to neither, see
StrategyMigration.
-
Nested Class Summary
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe monitor id, also its URL segment under/administrativeMonitor/.static final StringThetargetof aChangeType.STRATEGY_CHANGErecord (D-52).Fields inherited from class hudson.model.AdministrativeMonitor
id -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.kohsuke.stapler.HttpResponsedoMarkReviewed(String item) D-58b (3): "Mark as reviewed" for one listed item.org.kohsuke.stapler.HttpResponseInstalls the Batch Control subclass of the current plain matrix-auth (project or global) or role-strategy strategy with every entry kept, and saves.org.kohsuke.stapler.HttpResponsedoRevert()Installs the plain parent strategy of the current Batch Control strategy with every entry kept, and saves (the uninstall path).The display name of the installed strategy (for the view).D-58a: the items in the "changed under a grant" state (saved or created under a grant and not reviewed since by an administrator or a native Configure holder through the web), sorted, at most 50.booleanShows while change control is on and either the installed strategy is not a Batch Control strategy (isStrategyUnsupported()) or builds run as SYSTEM (isBuildAuthenticatorMissing()).booleanCondition 2 (D-35d (2), S-02): change control is on and noQueueItemAuthenticatoris configured, so builds run as SYSTEM.booleanCondition 3 (D-50, D-50a): with change control on, a build of a job without its own build authorization and without a user cause would run as SYSTEM under the configured build authenticators (for example Authorize Project per-project, or a strategy that follows the triggering user).booleanWhether the installed strategy can be copied into a Batch Control subclass (for the view).booleanWhether the migration would make per-item authorization properties effective (D-35d (3), S-04): the installed strategy is matrix-auth's global matrix, which ignores job, folder and agent properties, while the Batch Control matrix is project-based (for the view's warning).booleanWhether a Batch Control strategy is installed, so thatdoRevert()applies.booleanCondition 1 (D-35a): change control is on, but the installed strategy is not a Batch Control strategy, so active grants confer nothing (for the view).Methods inherited from class hudson.model.AdministrativeMonitor
all, checkRequiredPermission, disable, doDisable, getRequiredPermission, getSearchUrl, getTarget, getUrl, hasPermissionToDisplay, hasRequiredPermission, isActivationFake, isEnabled, isSecurityMethods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError, sendError, sendError, sendErrorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface hudson.search.SearchItem
getSearchGroup, getSearchIcon
-
Field Details
-
ID
The monitor id, also its URL segment under/administrativeMonitor/.- See Also:
-
STRATEGY_CHANGE_TARGET
Thetargetof aChangeType.STRATEGY_CHANGErecord (D-52).- See Also:
-
-
Constructor Details
-
BatchControlStrategyMonitor
public BatchControlStrategyMonitor()
-
-
Method Details
-
getDisplayName
- Specified by:
getDisplayNamein interfaceModelObject- Overrides:
getDisplayNamein classAdministrativeMonitor
-
isActivated
public boolean isActivated()Shows while change control is on and either the installed strategy is not a Batch Control strategy (isStrategyUnsupported()) or builds run as SYSTEM (isBuildAuthenticatorMissing()).- Specified by:
isActivatedin classAdministrativeMonitor
-
isBuildsMayRunAsSystem
public boolean isBuildsMayRunAsSystem()Condition 3 (D-50, D-50a): with change control on, a build of a job without its own build authorization and without a user cause would run as SYSTEM under the configured build authenticators (for example Authorize Project per-project, or a strategy that follows the triggering user). Instance-wide and cached (SystemBuildCheck), so rendering a page never probes on every call. -
isStrategyUnsupported
public boolean isStrategyUnsupported()Condition 1 (D-35a): change control is on, but the installed strategy is not a Batch Control strategy, so active grants confer nothing (for the view). -
isBuildAuthenticatorMissing
public boolean isBuildAuthenticatorMissing()Condition 2 (D-35d (2), S-02): change control is on and noQueueItemAuthenticatoris configured, so builds run as SYSTEM. A build running as SYSTEM (a Pipelineproperties([authorizationMatrix(...)])step, a Job DSL seed job) can then write an authorization property after a Configure grant holder edited the script, and the D-35b guard does not apply to SYSTEM saves. Configuring a build authenticator (Authorize Project) makes those saves the user's, so the guard applies. Only a warning: SYSTEM saves are not blocked. -
isMigratable
public boolean isMigratable()Whether the installed strategy can be copied into a Batch Control subclass (for the view). -
isPerItemWidening
public boolean isPerItemWidening()Whether the migration would make per-item authorization properties effective (D-35d (3), S-04): the installed strategy is matrix-auth's global matrix, which ignores job, folder and agent properties, while the Batch Control matrix is project-based (for the view's warning). -
isRevertable
public boolean isRevertable()Whether a Batch Control strategy is installed, so thatdoRevert()applies. -
getInstalledStrategyName
The display name of the installed strategy (for the view). -
doMigrate
Installs the Batch Control subclass of the current plain matrix-auth (project or global) or role-strategy strategy with every entry kept, and saves. Other strategies are refused with a plain message page (HTTP 400).- Throws:
IOException
-
doRevert
Installs the plain parent strategy of the current Batch Control strategy with every entry kept, and saves (the uninstall path). Grants stop conferring immediately. Refused with a plain message page (HTTP 400) when no Batch Control strategy is installed.- Throws:
IOException
-
getItemsChangedUnderGrant
D-58a: the items in the "changed under a grant" state (saved or created under a grant and not reviewed since by an administrator or a native Configure holder through the web), sorted, at most 50. They stay guarded until reviewed. Administrator-only page. -
doMarkReviewed
D-58b (3): "Mark as reviewed" for one listed item. Administrators only; the item and everything below it leave the "changed under a grant" state and a GUARD_REVIEWED record is written, then the confirmation page (batch-control/reviewed) is shown. Answers 404 for an item that does not exist.
-