Class LabelPermissionEnforcerImpl

java.lang.Object
com.atlassian.confluence.impl.labels.LabelPermissionEnforcerImpl
All Implemented Interfaces:
LabelPermissionEnforcer

public class LabelPermissionEnforcerImpl extends Object implements LabelPermissionEnforcer
Performs permission checking for label editing actions
Since:
6.9.0
  • Constructor Details

  • Method Details

    • isLabelableByUser

      public boolean isLabelableByUser(Labelable object)
      Description copied from interface: LabelPermissionEnforcer
      Checks that the object permits labels to be edited by the logged in user.
      Specified by:
      isLabelableByUser in interface LabelPermissionEnforcer
      Parameters:
      object - - the object to be labelled, if null returns false.
      Returns:
      true if permitted.
    • userCanEditLabel

      public boolean userCanEditLabel(ParsedLabelName ref, Labelable object)
      Description copied from interface: LabelPermissionEnforcer
      Check if the user can edit a label of an object
      Specified by:
      userCanEditLabel in interface LabelPermissionEnforcer
      Parameters:
      ref - the referen ce to the label
      object - the object associated with the label
      Returns:
      true if permitted
    • userCanEditLabel

      public boolean userCanEditLabel(Label label, Labelable object)
      Description copied from interface: LabelPermissionEnforcer
      Check if the user can edit a label of an object
      Specified by:
      userCanEditLabel in interface LabelPermissionEnforcer
      Parameters:
      label - the label
      object - the object associated with the label
      Returns:
      true if permitted
    • userCanEditLabelOrIsSpaceAdmin

      public boolean userCanEditLabelOrIsSpaceAdmin(Label label, SpaceContentEntityObject object)
      Description copied from interface: LabelPermissionEnforcer
      Check if the user can edit a label of a space object or a space admin
      Specified by:
      userCanEditLabelOrIsSpaceAdmin in interface LabelPermissionEnforcer
      Parameters:
      label - the label
      object - the space object
      Returns:
      true if permitted
    • userCanViewObject

      public boolean userCanViewObject(Labelable object)
      Description copied from interface: LabelPermissionEnforcer
      Check if the user can view the labelable object
      Specified by:
      userCanViewObject in interface LabelPermissionEnforcer
      Parameters:
      object - the labelable object
      Returns:
      true if permitted
    • filterVisibleLabels

      public List filterVisibleLabels(List labelList, @Nullable com.atlassian.user.User user, boolean hideSpecialLabels)
      Description copied from interface: LabelPermissionEnforcer
      Filters a list of label objects, removing any that are not visible to the specified user by checking the label's namespace. Also has an option to hide special labels.
      Specified by:
      filterVisibleLabels in interface LabelPermissionEnforcer
      Parameters:
      labelList - a list of Label objects
      user - the User the labels are filtered for
      hideSpecialLabels - whether to hide special labels, such as favourites
      Returns:
      a filtered list of Label objects
    • userCanViewLabel

      public boolean userCanViewLabel(Label label)
      Description copied from interface: LabelPermissionEnforcer
      Determines whether a given label is viewable by the logged-in user.
      Specified by:
      userCanViewLabel in interface LabelPermissionEnforcer
      Parameters:
      label - The label to check for viewability.
      Returns:
      true if the user can view the label; false otherwise.
    • filterAuthorizedLabels

      public List<Label> filterAuthorizedLabels(List<Label> labels)
      Description copied from interface: LabelPermissionEnforcer
      Filters a list of label objects, removing any that the logged-in user is not authorized to access. Authorization is determined by checking if the user has access to any of the content associated with the label.
      Specified by:
      filterAuthorizedLabels in interface LabelPermissionEnforcer
      Parameters:
      labels - a list of Label objects
      Returns:
      a filtered list of Label objects
    • filterLabelsByNamespace

      public List filterLabelsByNamespace(List labelList, @Nullable com.atlassian.user.User user, Namespace namespace)
      Description copied from interface: LabelPermissionEnforcer
      Takes a list of label objects and filters out those not in the specified namespace
      Specified by:
      filterLabelsByNamespace in interface LabelPermissionEnforcer
      Parameters:
      labelList - a list of Label objects
      user - the User the labels are filtered for
      namespace - the Namespace to filter by
      Returns:
      a filtered list of Label objects