Package hudson.model

Class AdministrativeMonitor

    • Field Detail

      • id

        public final String id
        Human-readable ID of this monitor, which needs to be unique within the system.

        This ID is used to remember persisted setting for this monitor, so the ID should remain consistent beyond the Hudson JVM lifespan.

    • Constructor Detail

      • AdministrativeMonitor

        protected AdministrativeMonitor​(String id)
      • AdministrativeMonitor

        protected AdministrativeMonitor()
    • Method Detail

      • getUrl

        public String getUrl()
        Returns the URL of this monitor, relative to the context path, like "administrativeMonitor/foobar".
      • getSearchUrl

        public final String getSearchUrl()
        Description copied from interface: SearchItem
        Returns the URL of this item relative to the parent SearchItem.
        Specified by:
        getSearchUrl in interface SearchItem
        Returns:
        URL like "foo" or "foo/bar". The path can end with '/'. The path that starts with '/' will be interpreted as the absolute path (within the context path of Jenkins.)
      • disable

        public void disable​(boolean value)
                     throws IOException
        Mark this monitor as disabled, to prevent this from showing up in the UI.
        Throws:
        IOException
      • isEnabled

        public boolean isEnabled()
        Returns true if this monitor isn't disabled earlier.

        This flag implements the ability for the admin to say "no thank you" to the monitor that he wants to ignore.

      • isActivated

        public abstract boolean isActivated()
        Returns true if this monitor is activated and wants to produce a warning message.

        This method is called from the HTML rendering thread, so it should run efficiently.

      • isSecurity

        public boolean isSecurity()
        Returns true if this monitor is security related. This will be used to determine which icon will be used in the navigation bar.
        Since:
        2.267
      • doDisable

        public void doDisable​(org.kohsuke.stapler.StaplerRequest req,
                              org.kohsuke.stapler.StaplerResponse rsp)
                       throws IOException
        URL binding to disable this monitor.
        Throws:
        IOException
      • getRequiredPermission

        public Permission getRequiredPermission()
        Required permission to view this admin monitor. By default Jenkins.ADMINISTER, but Jenkins.SYSTEM_READ is also supported.

        Changing this permission check to return Jenkins.SYSTEM_READ will make the active administrative monitor appear on manage.jelly and on the globally visible AdministrativeMonitorsDecorator to users without Administer permission. doDisable(StaplerRequest, StaplerResponse) will still always require Administer permission.

        Implementers need to ensure that doAct and other web methods perform necessary permission checks: Users with System Read permissions are expected to be limited to read-only access. Form UI elements that change system state, e.g. toggling a feature on or off, need to be hidden from users lacking Administer permission.

      • getTarget

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        public Object getTarget()
        Ensure that URLs in this administrative monitor are only accessible to users with getRequiredPermission().
        Specified by:
        getTarget in interface org.kohsuke.stapler.StaplerProxy