Class ScopeDisplay

java.lang.Object
io.jenkins.plugins.batchcontrol.ui.ScopeDisplay

@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public final class ScopeDisplay extends Object
D-75 (1), security-39 S-39-04 (SPEC item 8): the name a screen shows for the item of a grant request or permission window (tags/scopeItem.jelly).

A window follows its item when an administrator (or a user with their own permissions) renames or moves it (D-74 (3)), so its current full name can differ from the name the request was approved for. The followed name is shown only to a viewer who may read the item now: Visibility.findVisibleItem(java.lang.String) finds it as the viewer and the viewer holds Item/Read on it, or the viewer is an administrator (who sees the current name even after the item was deleted). Anyone else sees the approved name with a fixed note that the item was moved and its new location is not visible to them; nothing else about the new location is passed to the view (no link, no title, no kind resolved from the moved item). When the name did not change, nothing changes: the approved name is shown to every viewer of the request as before.

A window whose request is no longer stored has no approved name. Its name is then shown only under the same rule, and otherwise not at all (isNameHidden()).

Read-only and decided per rendering, as the viewer; no state, no permission switch.

  • Method Details

    • of

      public static ScopeDisplay of(@CheckForNull GrantScope approved, @CheckForNull GrantScope current)
      The name to show for a request approved for approved whose window now names current.
      Parameters:
      approved - the item the request was made for, or null when the request is not stored any more
      current - the window's item (Grant#getScope()), or null before there is a window
    • of

      public static ScopeDisplay of(@CheckForNull String approvedName, @CheckForNull String currentName)
    • getFullName

      @CheckForNull public String getFullName()
      The full name to show: the window's current one when it did not change or the viewer may read the item, otherwise the approved one. null only for a window whose request is no longer stored and whose item the viewer may not read.
    • isMoved

      public boolean isMoved()
      Whether the item was renamed or moved where the viewer may not read it, so the screen shows getFullName() (the approved name) with the fixed note instead of the current name.
    • isNameHidden

      public boolean isNameHidden()
      Whether no name can be shown at all (a moved window whose request is no longer stored).