com.atlassian.jira.issue.comments
Interface CommentPermissionManager

All Known Implementing Classes:
DefaultCommentPermissionManager

@PublicApi
public interface CommentPermissionManager

A unified way of checking whether a user can see a comment or not


Method Summary
 boolean hasBrowsePermission(ApplicationUser user, Comment comment)
          Return true if the user can see the comment.
 boolean hasBrowsePermission(com.atlassian.crowd.embedded.api.User user, Comment comment)
          Deprecated. Use hasBrowsePermission(com.atlassian.jira.user.ApplicationUser, Comment) instead. Since v6.0. Return true if the user can see the comment. It does not check if the user has the permission to see the issue the comment is attached to however.
 boolean hasDeleteAllPermission(ApplicationUser user, Issue issue)
          Returns true if the given User can delete all comments for the given Issue.
 boolean hasDeleteAllPermission(com.atlassian.crowd.embedded.api.User user, Issue issue)
          Deprecated. Use hasDeleteAllPermission(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.issue.Issue) instead. Since v6.0. Returns 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.

 boolean hasDeleteOwnPermission(ApplicationUser user, Issue issue)
          Returns true if the given User can delete her own comments in the given Issue.
 boolean hasDeleteOwnPermission(com.atlassian.crowd.embedded.api.User user, Issue issue)
          Deprecated. Use hasDeleteOwnPermission(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.issue.Issue) instead. Since v6.0. Returns 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.

 boolean hasEditAllPermission(ApplicationUser user, Issue issue)
          Returns true if user has permission to edit all comments in the given Issue.
 boolean hasEditAllPermission(com.atlassian.crowd.embedded.api.User user, Issue issue)
          Deprecated. Use hasEditAllPermission(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.issue.Issue) instead. Since v6.0. Returns 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.

 boolean hasEditOwnPermission(ApplicationUser user, Issue issue)
          Returns true if user has permission to edit her own comments in the given Issue.
 boolean hasEditOwnPermission(com.atlassian.crowd.embedded.api.User user, Issue issue)
          Deprecated. Use hasEditOwnPermission(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.issue.Issue) instead. Since v6.0. Returns 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.

 boolean hasEditPermission(ApplicationUser user, Comment comment)
          Determines whether the given user has permission to edit the given comment.
 boolean hasEditPermission(com.atlassian.crowd.embedded.api.User user, Comment comment)
          Deprecated. Use hasEditPermission(com.atlassian.jira.user.ApplicationUser, Comment) instead. Since v6.0. Determines whether the given user has permission to edit the given comment. The user is granted permission if they have the Permissions.COMMENT_EDIT_ALL permission or the Permissions.COMMENT_EDIT_OWN permission in case the user is the author of the given comment.

NOTE: The permissions will be determined by the permission scheme associated to the project the comment is a part of and the entries for the above mentioned permissions.

NOTE: This method does not check whether the Issue the comment belongs to is in an editable workflow state.

 boolean isUserCommentAuthor(ApplicationUser user, Comment comment)
          Returns true if the given user is the author of the given comment.
 boolean isUserCommentAuthor(com.atlassian.crowd.embedded.api.User user, Comment comment)
          Deprecated. Use isUserCommentAuthor(com.atlassian.jira.user.ApplicationUser, Comment) instead. Since v6.0. Returns 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.

 

Method Detail

hasBrowsePermission

boolean hasBrowsePermission(ApplicationUser user,
                            Comment comment)
Return true if the user can see the comment. It does not check if the user has the permission to see the issue the comment is attached to however.

Parameters:
user - user
comment - comment
Returns:
true if permission is granted, false otherwise

hasBrowsePermission

boolean hasBrowsePermission(com.atlassian.crowd.embedded.api.User user,
                            Comment comment)
Deprecated. Use hasBrowsePermission(com.atlassian.jira.user.ApplicationUser, Comment) instead. Since v6.0. Return true if the user can see the comment. It does not check if the user has the permission to see the issue the comment is attached to however.

Parameters:
user - user
comment - comment
Returns:
true if permission is granted, false otherwise

hasEditPermission

boolean hasEditPermission(ApplicationUser user,
                          Comment comment)
Determines whether the given user has permission to edit the given comment. The user is granted permission if they have the Permissions.COMMENT_EDIT_ALL permission or the Permissions.COMMENT_EDIT_OWN permission in case the user is the author of the given comment.

NOTE: The permissions will be determined by the permission scheme associated to the project the comment is a part of and the entries for the above mentioned permissions.

NOTE: This method does not check whether the Issue the comment belongs to is in an editable workflow state.

Parameters:
user - user
comment - comment
Returns:
true if permission is granted, false otherwise

hasEditPermission

boolean hasEditPermission(com.atlassian.crowd.embedded.api.User user,
                          Comment comment)
Deprecated. Use hasEditPermission(com.atlassian.jira.user.ApplicationUser, Comment) instead. Since v6.0. Determines whether the given user has permission to edit the given comment. The user is granted permission if they have the Permissions.COMMENT_EDIT_ALL permission or the Permissions.COMMENT_EDIT_OWN permission in case the user is the author of the given comment.

NOTE: The permissions will be determined by the permission scheme associated to the project the comment is a part of and the entries for the above mentioned permissions.

NOTE: This method does not check whether the Issue the comment belongs to is in an editable workflow state.

Parameters:
user - user
comment - comment
Returns:
true if permission is granted, false otherwise

hasEditAllPermission

boolean hasEditAllPermission(ApplicationUser user,
                             Issue issue)
Returns 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.

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.

hasEditAllPermission

boolean hasEditAllPermission(com.atlassian.crowd.embedded.api.User user,
                             Issue issue)
Deprecated. Use hasEditAllPermission(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.issue.Issue) instead. Since v6.0. Returns 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.

Parameters:
user - User. 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

boolean hasEditOwnPermission(ApplicationUser user,
                             Issue issue)
Returns 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.

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

boolean hasEditOwnPermission(com.atlassian.crowd.embedded.api.User user,
                             Issue issue)
Deprecated. Use hasEditOwnPermission(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.issue.Issue) instead. Since v6.0. Returns 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.

Parameters:
user - User. 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

boolean hasDeleteAllPermission(ApplicationUser user,
                               Issue issue)
Returns 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.

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.

hasDeleteAllPermission

boolean hasDeleteAllPermission(com.atlassian.crowd.embedded.api.User user,
                               Issue issue)
Deprecated. Use hasDeleteAllPermission(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.issue.Issue) instead. Since v6.0. Returns 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.

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

boolean hasDeleteOwnPermission(ApplicationUser user,
                               Issue issue)
Returns 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.

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.

hasDeleteOwnPermission

boolean hasDeleteOwnPermission(com.atlassian.crowd.embedded.api.User user,
                               Issue issue)
Deprecated. Use hasDeleteOwnPermission(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.issue.Issue) instead. Since v6.0. Returns 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.

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.

isUserCommentAuthor

boolean isUserCommentAuthor(ApplicationUser user,
                            Comment comment)
Returns 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.

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.

isUserCommentAuthor

boolean isUserCommentAuthor(com.atlassian.crowd.embedded.api.User user,
                            Comment comment)
Deprecated. Use isUserCommentAuthor(com.atlassian.jira.user.ApplicationUser, Comment) instead. Since v6.0. Returns 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.

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.


Copyright © 2002-2014 Atlassian. All Rights Reserved.