Package com.atlassian.confluence.labels
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 Summary
Modifier and TypeMethodDescriptionfilterLabelsByNamespace
(List labelList, com.atlassian.user.User user, Namespace namespace) Takes a list of label objects and filters out those not in the specified namespacefilterVisibleLabels
(List labelList, com.atlassian.user.User user, boolean hideSpecialLabels) Takes a list of label objects and filters out those not visible to the given userboolean
isLabelableByUser
(Labelable object) Checks that the object permits labels to be edited by the logged in user.boolean
userCanEditLabel
(Label label, Labelable object) Check if the user can edit a label of an objectboolean
userCanEditLabel
(ParsedLabelName ref, Labelable object) Check if the user can edit a label of an objectboolean
userCanEditLabelOrIsSpaceAdmin
(Label label, SpaceContentEntityObject object) Check if the user can edit a label of a space object or a space adminboolean
userCanViewObject
(Labelable object) Check if the user can view the labelable object
-
Method Details
-
isLabelableByUser
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
Check if the user can edit a label of an object- Parameters:
ref
- the referen ce to the labelobject
- the object associated with the label- Returns:
- true if permitted
-
userCanEditLabel
Check if the user can edit a label of an object- Parameters:
label
- the labelobject
- the object associated with the label- Returns:
- true if permitted
-
userCanEditLabelOrIsSpaceAdmin
Check if the user can edit a label of a space object or a space admin- Parameters:
label
- the labelobject
- the space object- Returns:
- true if permitted
-
userCanViewObject
Check if the user can view the labelable object- Parameters:
object
- the labelable object- Returns:
- true if permitted
-
filterVisibleLabels
Takes a list of label objects and filters out those not visible to the given user- Parameters:
labelList
- a list of Label objectsuser
- the User the labels are filtered forhideSpecialLabels
- whether to hide special labels, such as favourites- Returns:
- a filtered list of Label objects
-
filterLabelsByNamespace
Takes a list of label objects and filters out those not in the specified namespace- Parameters:
labelList
- a list of Label objectsuser
- the User the labels are filtered fornamespace
- the Namespace to filter by- Returns:
- a filtered list of Label objects
-