Class BatchControlGlobalConfiguration

java.lang.Object
hudson.model.Descriptor<GlobalConfiguration>
jenkins.model.GlobalConfiguration
io.jenkins.plugins.batchcontrol.config.BatchControlGlobalConfiguration
All Implemented Interfaces:
ExtensionPoint, Describable<GlobalConfiguration>, Saveable, Loadable, OnMaster

@Extension @Symbol("batchControl") @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public class BatchControlGlobalConfiguration extends GlobalConfiguration
Global plugin configuration (SPEC section 5 keys and defaults). Nothing is active until an administrator turns a switch on; toggling either switch writes a ChangeRecord(CONFIG_TOGGLE) to the store (SPEC item 1).

e2e-03 DEF-08: the web form is validated before anything is bound. Each field has a doCheck* method, so the message appears next to the field while typing, and configure(org.kohsuke.stapler.StaplerRequest2, net.sf.json.JSONObject) refuses a submission holding an invalid value with a Descriptor.FormException naming that field; nothing is saved then. The setters (JCasC, scripts) still ignore non-positive values, so an invalid value can never be persisted on any path.

e2e-03 DEF-10: BatchControl/Manage is enough to open and save this configuration (getRequiredGlobalConfigPagePermission(), and BatchControlConfigurationLink for a holder who cannot open core's system configuration page).

  • Field Details

  • Constructor Details

    • BatchControlGlobalConfiguration

      public BatchControlGlobalConfiguration()
  • Method Details

    • save

      public void save()
      S-25-06: a detached draft or candidate is never written to config.xml.
      Specified by:
      save in interface Saveable
      Overrides:
      save in class Descriptor<GlobalConfiguration>
    • get

      public static BatchControlGlobalConfiguration get()
    • getDisplayName

      public String getDisplayName()
      Overrides:
      getDisplayName in class Descriptor<GlobalConfiguration>
    • getRequiredGlobalConfigPagePermission

      public Permission getRequiredGlobalConfigPagePermission()
      e2e-03 DEF-10: this section is shown and saved for BatchControl/Manage holders (implied by Overall/Administer) rather than for administrators only.
      Overrides:
      getRequiredGlobalConfigPagePermission in class Descriptor<GlobalConfiguration>
    • configure

      public boolean configure(org.kohsuke.stapler.StaplerRequest2 req, net.sf.json.JSONObject json) throws Descriptor.FormException
      Overrides:
      configure in class GlobalConfiguration
      Throws:
      Descriptor.FormException
    • isRunControlEnabled

      public boolean isRunControlEnabled()
    • setRunControlEnabled

      public void setRunControlEnabled(boolean enabled)
      Direct switch change (JCasC, script console). D-42 / security-09 S-01: this never fails the caller. The new value is applied in memory, the toggle record and side effects follow, and the configuration is then persisted; a failed write is logged at SEVERE and swallowed, so a boot-time JCasC apply cannot abort startup and a switch JCasC turns on is on. The web form path (configure(org.kohsuke.stapler.StaplerRequest2, net.sf.json.JSONObject)) stays transactional.
    • isChangeControlEnabled

      public boolean isChangeControlEnabled()
    • setChangeControlEnabled

      public void setChangeControlEnabled(boolean enabled)
      S-15: turning change control off is a kill switch, not just a stop on new windows. Setting the field false makes security.GrantAwareACL stop consulting grants immediately, and the revocation in afterSwitchesChanged(boolean, boolean) closes the windows that are already open, so they cannot come back to life when the switch is turned on again.

      The accepted cost, and the owner's deliberate choice: every change that is underway inside a permission window right now is cut off with no warning. A switch that instead left windows quietly conferring Item/Configure for up to maxGrantMinutes afterwards was judged the worse of the two, so long as the cut is recorded — which GrantService#revokeAllActive does, one GRANT_REVOKE record per closed window.

      On the form path the revocation runs only once the new value is durable; per D-42 a direct call revokes even if persisting then fails (revocation only removes permissions).

    • getApprovers

      public List<String> getApprovers()
    • setApprovers

      public void setApprovers(List<String> approvers)
    • getApproversText

      public String getApproversText()
    • setApproversText

      public void setApproversText(String text)
    • isAllowAdminSelfApproval

      public boolean isAllowAdminSelfApproval()
    • setAllowAdminSelfApproval

      public void setAllowAdminSelfApproval(boolean allowAdminSelfApproval)
    • getPendingTimeoutHours

      public int getPendingTimeoutHours()
    • setPendingTimeoutHours

      public void setPendingTimeoutHours(int pendingTimeoutHours)
    • getApprovedRunTimeoutMinutes

      public int getApprovedRunTimeoutMinutes()
    • setApprovedRunTimeoutMinutes

      public void setApprovedRunTimeoutMinutes(int approvedRunTimeoutMinutes)
    • getGrantDurationOptions

      public List<Integer> getGrantDurationOptions()
    • setGrantDurationOptions

      public void setGrantDurationOptions(List<Integer> grantDurationOptions)
    • getGrantDurationOptionsText

      public String getGrantDurationOptionsText()
    • setGrantDurationOptionsText

      public void setGrantDurationOptionsText(String text)
    • getMaxGrantMinutes

      public int getMaxGrantMinutes()
    • setMaxGrantMinutes

      public void setMaxGrantMinutes(int maxGrantMinutes)
    • getIncidentResults

      public List<String> getIncidentResults()
    • setIncidentResults

      public void setIncidentResults(List<String> incidentResults)
    • getIncidentResultsText

      public String getIncidentResultsText()
    • setIncidentResultsText

      public void setIncidentResultsText(String text)
    • getRetentionMonths

      public int getRetentionMonths()
    • setRetentionMonths

      public void setRetentionMonths(int retentionMonths)
    • isEmailNotifications

      public boolean isEmailNotifications()
    • setEmailNotifications

      @DataBoundSetter public void setEmailNotifications(boolean emailNotifications)
    • getNotifyBeforeExpiryMinutes

      public int getNotifyBeforeExpiryMinutes()
    • setNotifyBeforeExpiryMinutes

      @DataBoundSetter public void setNotifyBeforeExpiryMinutes(int notifyBeforeExpiryMinutes)
    • isMailerAvailable

      public boolean isMailerAvailable()
      Whether the Mailer plugin is installed and active; the configuration page shows the emailNotifications option only then (D-36).
    • doCheckApproversText

      @POST public FormValidation doCheckApproversText(@QueryParameter String value)
      Stapler form validation of the approver list (read-only, D-53).
    • doCheckPendingTimeoutHours

      @POST public FormValidation doCheckPendingTimeoutHours(@QueryParameter String value)
      Stapler form validation (read-only).
    • doCheckApprovedRunTimeoutMinutes

      @POST public FormValidation doCheckApprovedRunTimeoutMinutes(@QueryParameter String value)
      Stapler form validation (read-only).
    • doCheckMaxGrantMinutes

      @POST public FormValidation doCheckMaxGrantMinutes(@QueryParameter String value)
      Stapler form validation (read-only).
    • doCheckRetentionMonths

      @POST public FormValidation doCheckRetentionMonths(@QueryParameter String value)
      Stapler form validation (read-only).
    • doCheckNotifyBeforeExpiryMinutes

      @POST public FormValidation doCheckNotifyBeforeExpiryMinutes(@QueryParameter String value)
      Stapler form validation (read-only).
    • doCheckGrantDurationOptionsText

      @POST public FormValidation doCheckGrantDurationOptionsText(@QueryParameter String value, @QueryParameter String maxGrantMinutes)
      Stapler form validation (read-only); re-run when the maximum changes.
    • doCheckIncidentResultsText

      @POST public FormValidation doCheckIncidentResultsText(@QueryParameter String value)
      Stapler form validation (read-only).
    • doCheckGrantDurationOptions

      @POST public FormValidation doCheckGrantDurationOptions(@QueryParameter String value, @QueryParameter String maxGrantMinutes)
      Stapler form validation of the field named by its SPEC key (read-only).
    • doCheckIncidentResults

      @POST public FormValidation doCheckIncidentResults(@QueryParameter String value)
      Stapler form validation of the field named by its SPEC key (read-only).