com.atlassian.jira.issue.comments
Class DefaultCommentPermissionManager

java.lang.Object
  extended by com.atlassian.jira.issue.comments.DefaultCommentPermissionManager
All Implemented Interfaces:
CommentPermissionManager

public class DefaultCommentPermissionManager
extends Object
implements CommentPermissionManager

This permission manager is responsible to check and grant browse and edit permissions to users over issue comments.


Constructor Summary
DefaultCommentPermissionManager(ProjectRoleManager projectRoleManager, PermissionManager permissionManager)
           
 
Method Summary
 boolean hasBrowsePermission(Comment comment, User user)
          Determines whether the user can see given comment.
 boolean hasEditPermission(Comment comment, User user)
          Determines whether the user can edit given comment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultCommentPermissionManager

public DefaultCommentPermissionManager(ProjectRoleManager projectRoleManager,
                                       PermissionManager permissionManager)
Method Detail

hasBrowsePermission

public boolean hasBrowsePermission(Comment comment,
                                   User user)
Determines whether the user can see given comment.

User can see the comment if comment does not have restricted visibility, otherwise only if the user is in either comments group or project role visibility level.

Specified by:
hasBrowsePermission in interface CommentPermissionManager
Parameters:
comment - comment
user - user
Returns:
true if user can see the comment, false otherwise

hasEditPermission

public boolean hasEditPermission(Comment comment,
                                 User user)
Determines whether the user can edit given comment.

User can edit the given comment if he can edit all comment of the associated issue or is the author of this comment and has edit own comments permission granted.

Specified by:
hasEditPermission in interface CommentPermissionManager
Parameters:
comment - comment to edit
user - user
Returns:
true if user can edit the given comment, false otherwise


Copyright © 2002-2009 Atlassian. All Rights Reserved.