Interface LabelPermissionEnforcer

  • All Known Implementing Classes:
    LabelPermissionEnforcerImpl

    public interface LabelPermissionEnforcer
    A permission enforcer interface for labels. These logic should be moved to ContentLabelService.Validator in the near future.
    Since:
    6.9.0
    • Method Detail

      • isLabelableByUser

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

        boolean userCanEditLabel​(ParsedLabelName ref,
                                 Labelable object)
        Check if the user can edit a label of an object
        Parameters:
        ref - the referen ce to the label
        object - the object associated with the label
        Returns:
        true if permitted
      • userCanEditLabel

        boolean userCanEditLabel​(Label label,
                                 Labelable object)
        Check if the user can edit a label of an object
        Parameters:
        label - the label
        object - the object associated with the label
        Returns:
        true if permitted
      • userCanEditLabelOrIsSpaceAdmin

        boolean userCanEditLabelOrIsSpaceAdmin​(Label label,
                                               SpaceContentEntityObject object)
        Check if the user can edit a label of a space object or a space admin
        Parameters:
        label - the label
        object - the space object
        Returns:
        true if permitted
      • userCanViewObject

        boolean userCanViewObject​(Labelable object)
        Check if the user can view the labelable object
        Parameters:
        object - the labelable object
        Returns:
        true if permitted
      • filterVisibleLabels

        List filterVisibleLabels​(List labelList,
                                 com.atlassian.user.User user,
                                 boolean hideSpecialLabels)
        Takes a list of label objects and filters out those not visible to the given user
        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
      • filterLabelsByNamespace

        List filterLabelsByNamespace​(List labelList,
                                     com.atlassian.user.User user,
                                     Namespace namespace)
        Takes a list of label objects and filters out those not in the specified namespace
        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