Class DefaultCommentPermissionManager
- All Implemented Interfaces:
CommentPermissionManager
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultCommentPermissionManager(ProjectRoleManager projectRoleManager, PermissionManager permissionManager, GroupManager groupManager) -
Method Summary
Modifier and TypeMethodDescriptionbooleanhasBrowsePermission(ApplicationUser user, Comment comment) Determines whether the user can see given comment, or is prevented by restrictions on the visibility of the comment (either group- or Project Role-based)booleanhasDeleteAllPermission(ApplicationUser user, Issue issue) Returns true if the given User can delete all comments for the given Issue.booleanhasDeleteOwnPermission(ApplicationUser user, Issue issue) Returns true if the given User can delete her own comments in the given Issue.booleanhasEditAllPermission(ApplicationUser user, Issue issue) Returns true if user has permission to edit all comments in the given Issue.booleanhasEditOwnPermission(ApplicationUser user, Issue issue) Returns true if user has permission to edit her own comments in the given Issue.booleanhasEditPermission(ApplicationUser user, Comment comment) Determines whether the user can edit given comment.booleanisUserCommentAuthor(ApplicationUser user, Comment comment) Returns true if the given user is the author of the given comment.
-
Constructor Details
-
DefaultCommentPermissionManager
public DefaultCommentPermissionManager(ProjectRoleManager projectRoleManager, PermissionManager permissionManager, GroupManager groupManager)
-
-
Method Details
-
hasBrowsePermission
Determines whether the user can see given comment, or is prevented by restrictions on the visibility of the comment (either group- or Project Role-based)The User can always see the comment if the comment does not have restricted visibility, otherwise only if the user is in either comments group or project role visibility level.
- Specified by:
hasBrowsePermissionin interfaceCommentPermissionManager- Parameters:
user- application usercomment- comment- Returns:
- true if user can see the comment, false otherwise
-
hasEditPermission
Determines whether the user can edit given comment.The User can edit the given comment if he or she can edit all comments for the issue, or is the author and has "edit own comments" permission.
- Specified by:
hasEditPermissionin interfaceCommentPermissionManager- Parameters:
user- usercomment- comment to edit- Returns:
- true if user can edit the given comment, false otherwise
-
isUserCommentAuthor
Description copied from interface:CommentPermissionManagerReturns true if the given user is the author of the given comment.If the given Comment has a null author, this represents that it was created anonymously, and no-one is the author (returns false). If the given User is null, then this represents that the current user is anonymous, and the method will always return false.
- Specified by:
isUserCommentAuthorin interfaceCommentPermissionManager- Parameters:
user- The User. Can be null to represent current user is not logged in (anonymous).comment- The Comment. Cannot be null.- Returns:
- true if the given user is the author of the given comment.
-
hasEditAllPermission
Description copied from interface:CommentPermissionManagerReturns true if user has permission to edit all comments in the given Issue.NOTE: This method does not check whether the Issue the comment belongs to is in an editable workflow state.
- Specified by:
hasEditAllPermissionin interfaceCommentPermissionManager- Parameters:
user-ApplicationUser. A null value represents an anonymous User.issue- Issue. Must not be null.- Returns:
- true if user has permission to edit all comments in the given Issue.
-
hasEditOwnPermission
Description copied from interface:CommentPermissionManagerReturns true if user has permission to edit her own comments in the given Issue.NOTE: This method does not check whether the Issue the comment belongs to is in an editable workflow state.
- Specified by:
hasEditOwnPermissionin interfaceCommentPermissionManager- Parameters:
user-ApplicationUser. A null value represents an anonymous User.issue- Issue. Must not be null.- Returns:
- true if user has permission to edit all comments in the given Issue.
-
hasDeleteAllPermission
Description copied from interface:CommentPermissionManagerReturns true if the given User can delete all comments for the given Issue.NOTE: This method does not check whether the Issue the comment belongs to is in an editable workflow state.
- Specified by:
hasDeleteAllPermissionin interfaceCommentPermissionManager- Parameters:
user- User. A null value represents an anonymous User.issue- Issue. Must not be null.- Returns:
- true if user has permission to delete all comments in the given Issue.
-
hasDeleteOwnPermission
Description copied from interface:CommentPermissionManagerReturns true if the given User can delete her own comments in the given Issue.NOTE: This method does not check whether the Issue the comment belongs to is in an editable workflow state.
- Specified by:
hasDeleteOwnPermissionin interfaceCommentPermissionManager- Parameters:
user- User. A null value represents an anonymous User.issue- Issue. Must not be null.- Returns:
- true if the given User can delete her own comments in the given Issue.
-