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 TypeMethodDescriptionfilterAuthorizedLabels
(List<Label> labelList) Filters a list of label objects, removing any that the logged-in user is not authorized to access.filterLabelsByNamespace
(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) Filters a list of label objects, removing any that are not visible to the specified user by checking the label's namespace.boolean
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
userCanViewLabel
(Label label) Determines whether a given label is viewable by the logged-in user.boolean
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
-
userCanViewLabel
Determines whether a given label is viewable by the logged-in user.- Parameters:
label
- The label to check for viewability.- Returns:
- true if the user can view the label; false otherwise.
-
filterVisibleLabels
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.- 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
-
filterAuthorizedLabels
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.- Parameters:
labelList
- a list of Label objects- 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
-