com.atlassian.crowd.embedded.spi
Interface MembershipDao


public interface MembershipDao


Method Summary
 BatchResult<String> addAllUsersToGroup(long directoryId, Collection<String> userNames, String groupName)
          Bulk adds all the given users into the given group.
 void addGroupToGroup(long directoryId, String childGroup, String parentGroup)
          Adds group as a child of the (supposedly) parent group.
 void addUserToGroup(long directoryId, String userName, String groupName)
          Adds user as a member of group.
 boolean isGroupDirectMember(long directoryId, String childGroup, String parentGroup)
          Determines whether the group is a direct member of the (supposedly) parent group.
 boolean isUserDirectMember(long directoryId, String userName, String groupName)
          Determines whether the user is a direct member of the group.
 void removeGroupFromGroup(long directoryId, String childGroup, String parentGroup)
          Removes group from the parent group.
 void removeUserFromGroup(long directoryId, String userName, String groupName)
          Removes user as a member of the given group.
<T> List<T>
search(long directoryId, MembershipQuery<T> query)
          Search for memberships by the given criteria.
 

Method Detail

isUserDirectMember

boolean isUserDirectMember(long directoryId,
                           String userName,
                           String groupName)
Determines whether the user is a direct member of the group.

Parameters:
directoryId - the directory to perform the operation
userName - user
groupName - group
Returns:
true if the user is a direct member of the group

isGroupDirectMember

boolean isGroupDirectMember(long directoryId,
                            String childGroup,
                            String parentGroup)
Determines whether the group is a direct member of the (supposedly) parent group.

Parameters:
directoryId - the directory to perform the operation
childGroup - child group
parentGroup - parent group
Returns:
true if the group is a direct member of the (supposedly) parent group

addUserToGroup

void addUserToGroup(long directoryId,
                    String userName,
                    String groupName)
                    throws com.atlassian.crowd.exception.UserNotFoundException,
                           com.atlassian.crowd.exception.GroupNotFoundException,
                           com.atlassian.crowd.exception.MembershipAlreadyExistsException
Adds user as a member of group.

Parameters:
directoryId - the directory to perform the operation
userName - user
groupName - group
Throws:
com.atlassian.crowd.exception.UserNotFoundException - if the user does not exist
com.atlassian.crowd.exception.GroupNotFoundException - if the group does not exist
com.atlassian.crowd.exception.MembershipAlreadyExistsException - if the user is already a direct member of the group

addAllUsersToGroup

BatchResult<String> addAllUsersToGroup(long directoryId,
                                       Collection<String> userNames,
                                       String groupName)
                                       throws com.atlassian.crowd.exception.GroupNotFoundException
Bulk adds all the given users into the given group. Users that are already direct members of the group are reported as failures. Usernames that cannot be found in the database are also reported as failures. Implementations must make sure that changes in bulk methods such as this are immediately visible to other bulk methods. For example, if this is run in a transaction, either that transaction must be committed when this method returns, or all other bulk method implementations must guarantee to reuse the same transaction.

Parameters:
directoryId - the directory to perform the operation
userNames - the collection of users
groupName - name of the group
Returns:
result containing both successful (membership successfully added) and failed users (unknown username, or already existing membership)
Throws:
com.atlassian.crowd.exception.GroupNotFoundException - if the group does not exist

addGroupToGroup

void addGroupToGroup(long directoryId,
                     String childGroup,
                     String parentGroup)
                     throws com.atlassian.crowd.exception.GroupNotFoundException,
                            com.atlassian.crowd.exception.MembershipAlreadyExistsException
Adds group as a child of the (supposedly) parent group.

Parameters:
directoryId - the directory to perform the operation
childGroup - the (supposedly) child group
parentGroup - parent group
Throws:
com.atlassian.crowd.exception.GroupNotFoundException - if either child or parent group is not found
com.atlassian.crowd.exception.MembershipAlreadyExistsException - if the child group is already a child of the parent group

removeUserFromGroup

void removeUserFromGroup(long directoryId,
                         String userName,
                         String groupName)
                         throws com.atlassian.crowd.exception.UserNotFoundException,
                                com.atlassian.crowd.exception.GroupNotFoundException,
                                com.atlassian.crowd.exception.MembershipNotFoundException
Removes user as a member of the given group.

Parameters:
directoryId - the directory to perform the operation
userName - user
groupName - group
Throws:
com.atlassian.crowd.exception.UserNotFoundException - if the user does not exist
com.atlassian.crowd.exception.GroupNotFoundException - if the group does not exist
com.atlassian.crowd.exception.MembershipNotFoundException - if the user is not a member of the said group

removeGroupFromGroup

void removeGroupFromGroup(long directoryId,
                          String childGroup,
                          String parentGroup)
                          throws com.atlassian.crowd.exception.GroupNotFoundException,
                                 com.atlassian.crowd.exception.MembershipNotFoundException
Removes group from the parent group.

Parameters:
directoryId - the directory to perform the operation
childGroup - child group
parentGroup - parent group
Throws:
com.atlassian.crowd.exception.GroupNotFoundException - if either child or parent group does not exist
com.atlassian.crowd.exception.MembershipNotFoundException - if the membership relationship between the child and parent group does not exist

search

<T> List<T> search(long directoryId,
                   MembershipQuery<T> query)
Search for memberships by the given criteria.

Parameters:
directoryId - the directory to perform the operation
query - criteria
Returns:
list (can be empty but never null) of memberships which match the given criteria


Copyright © 2014 Atlassian. All Rights Reserved.