com.atlassian.jira.sharing
Interface ShareManager

All Known Implementing Classes:
DefaultShareManager

public interface ShareManager

Interface for managing SharePermission objects.

Since:
v3.13

Method Summary
 void deletePermissions(SharedEntity entity)
          Delete all permissions associated with an entity
 void deleteSharePermissionsLike(SharePermission permission)
          Deletes SharePermission's that have the same "shape" as the provided share permission.
 SharedEntity.SharePermissions getSharePermissions(SharedEntity entity)
          Retrieve all SharePermission instances associated with a passed in SharedEntity
 boolean hasPermission(com.atlassian.crowd.embedded.api.User user, SharedEntity entity)
          Deprecated. since 5.0 please use isSharedWith(com.atlassian.crowd.embedded.api.User, SharedEntity) to get the same logic. Permission checks should be done in the service layer according to this information.
 boolean isSharedWith(ApplicationUser user, SharedEntity sharedEntity)
          Whether this entity has been shared with the specified user.
 boolean isSharedWith(com.atlassian.crowd.embedded.api.User user, SharedEntity sharedEntity)
          Whether this entity has been shared with the specified user.
 SharedEntity.SharePermissions updateSharePermissions(SharedEntity entity)
          Updates the SharePermission associated with an entity.
 

Method Detail

getSharePermissions

SharedEntity.SharePermissions getSharePermissions(SharedEntity entity)
Retrieve all SharePermission instances associated with a passed in SharedEntity

Parameters:
entity - The entity that has permissions associated with it
Returns:
A set of SharePermission instances associated with the entity.

deletePermissions

void deletePermissions(SharedEntity entity)
Delete all permissions associated with an entity

Parameters:
entity - The entity that will have all its permissions deleted

updateSharePermissions

SharedEntity.SharePermissions updateSharePermissions(SharedEntity entity)
Updates the SharePermission associated with an entity. Looks after creation and updating of permissions.

Parameters:
entity - The entity that has permissions associated with it
Returns:
The new SharePermissions associated with the entity

isSharedWith

boolean isSharedWith(ApplicationUser user,
                     SharedEntity sharedEntity)
Whether this entity has been shared with the specified user.

Parameters:
user - The user to check.
sharedEntity - The entity to check.
Returns:
true if the entity has been shared with the user, or if the user owns the entity; otherwise, false.

isSharedWith

boolean isSharedWith(com.atlassian.crowd.embedded.api.User user,
                     SharedEntity sharedEntity)
Whether this entity has been shared with the specified user.

Parameters:
user - The user to check.
sharedEntity - The entity to check.
Returns:
true if the entity has been shared with the user, or if the user owns the entity; otherwise, false.

hasPermission

@Deprecated
boolean hasPermission(com.atlassian.crowd.embedded.api.User user,
                                 SharedEntity entity)
Deprecated. since 5.0 please use isSharedWith(com.atlassian.crowd.embedded.api.User, SharedEntity) to get the same logic. Permission checks should be done in the service layer according to this information.

Checks to see if the user has permission to see this SharedEntity

Parameters:
user - The user to check permissions for
entity - The entity that has permissions associated with it
Returns:
returns true if the user has appropriate permissions, otherwise false.

deleteSharePermissionsLike

void deleteSharePermissionsLike(SharePermission permission)
Deletes SharePermission's that have the same "shape" as the provided share permission. It uses the type, param1, and param2 to as the basis for deleting SharePermission's.

Parameters:
permission - a 'template' of the type of SharePermission you want to delete
Throws:
IllegalArgumentException - if you provide a null SharePermission or one that does not have a type and (param1 or param2).


Copyright © 2002-2013 Atlassian. All Rights Reserved.