com.atlassian.crowd.embedded.api
Interface CrowdService

All Known Subinterfaces:
CrowdAdminService
All Known Implementing Classes:
CrowdAdminServiceImpl, CrowdServiceImpl

public interface CrowdService


Method Summary
 User authenticate(java.lang.String name, java.lang.String credential)
          Authenticates a user with the given credential
 Group getGroup(java.lang.String name)
          Finds the group that matches the supplied name.
 GroupWithAttributes getGroupWithAttributes(java.lang.String name)
          Finds the group that matches the supplied name.
 User getUser(java.lang.String name)
          Returns the user that matches the supplied name.
 UserWithAttributes getUserWithAttributes(java.lang.String name)
          Returns the user that matches the supplied name.
 boolean isGroupMemberOfGroup(Group childGroup, Group parentGroup)
          Returns true if the childGroup is a direct or indirect (nested) member of the parentGroup.
 boolean isUserMemberOfGroup(java.lang.String userName, java.lang.String groupName)
          Returns true if the user is a direct or indirect (nested) member of the group.
 boolean isUserMemberOfGroup(User user, Group group)
          Returns true if the user is a direct or indirect (nested) member of the group.
<T> java.lang.Iterable<T>
search(Query<T> query)
          Searches for entities (e.g.
 

Method Detail

authenticate

User authenticate(java.lang.String name,
                  java.lang.String credential)
                  throws UserNotFoundException,
                         InactiveAccountException,
                         FailedAuthenticationException,
                         ExpiredCredentialException,
                         OperationFailedException
Authenticates a user with the given credential

Parameters:
name - The name of the user (username).
credential - The supplied credential to authenticate with
Returns:
The populated user if the authentication is valid.
Throws:
InactiveAccountException - The supplied user is inactive.
FailedAuthenticationException - Authentication with the provided credentials failed.
UserNotFoundException - thrown if the name didn't resolve to a User
ExpiredCredentialException - The user's credentials have expired. The user must change their credentials in order to successfully authenticate.
OperationFailedException - underlying directory implementation failed to execute the operation.

getUser

User getUser(java.lang.String name)
Returns the user that matches the supplied name.

Parameters:
name - the name of the user (username). Does not allow null, blank or empty strings.
Returns:
user entity or null if the user is not found

getUserWithAttributes

UserWithAttributes getUserWithAttributes(java.lang.String name)
Returns the user that matches the supplied name.

Parameters:
name - the name of the user (username).
Returns:
user entity with attributes or null if the user is not found

getGroup

Group getGroup(java.lang.String name)
Finds the group that matches the supplied name.

Parameters:
name - the name of the group.
Returns:
group entity, null if not found.

getGroupWithAttributes

GroupWithAttributes getGroupWithAttributes(java.lang.String name)
Finds the group that matches the supplied name.

Parameters:
name - the name of the group.
Returns:
group entity with attributes, null if not found.

search

<T> java.lang.Iterable<T> search(Query<T> query)
Searches for entities (e.g. Group or User) of type <T> that match the supplied search query. Search return types must be either String, User or Group.

Parameters:
query - Query for a given entity (e.g. Group or User)
Returns:
entities of type T matching the search query. An Iterable containing no results will be returned if there are no matches for the query.

isUserMemberOfGroup

boolean isUserMemberOfGroup(java.lang.String userName,
                            java.lang.String groupName)
                            throws UserNotFoundException,
                                   GroupNotFoundException
Returns true if the user is a direct or indirect (nested) member of the group.

Parameters:
userName - user to inspect.
groupName - group to inspect.
Returns:
true if and only if the user is a direct or indirect (nested) member of the group.
Throws:
UserNotFoundException - if the userName doesn't resolve to an existing user.
GroupNotFoundException - if the groupName doesn't resolve to an existing group.
See Also:
isUserMemberOfGroup(User, Group)

isUserMemberOfGroup

boolean isUserMemberOfGroup(User user,
                            Group group)
                            throws UserNotFoundException,
                                   GroupNotFoundException
Returns true if the user is a direct or indirect (nested) member of the group.

Parameters:
user - user to inspect.
group - group to inspect.
Returns:
true if and only if the user is a direct or indirect (nested) member of the group.
Throws:
UserNotFoundException - if the userName doesn't resolve to an existing user.
GroupNotFoundException - if the groupName doesn't resolve to an existing group.
See Also:
isUserMemberOfGroup(String, String)

isGroupMemberOfGroup

boolean isGroupMemberOfGroup(Group childGroup,
                             Group parentGroup)
                             throws GroupNotFoundException
Returns true if the childGroup is a direct or indirect (nested) member of the parentGroup.

Parameters:
childGroup - group to inspect.
parentGroup - group to inspect.
Returns:
true if and only if the childGroup is a direct or indirect (nested) member of the parentGroup.
Throws:
GroupNotFoundException - if either groupd (childGroup or parentGroup) doesn't resolve to an existing group.


Copyright © 2010 Atlassian. All Rights Reserved.