View Javadoc

1   package com.atlassian.user.impl.ldap.adaptor;
2   
3   /**
4    * Implementations of this adaptor will allow groups to be retrieved
5    * from LDAP systems, each with their own different way of structuring groups.
6    * <p>
7    *
8    * When constructing the actual {@link Group} object it is appropriate to use
9    * a {@link com.atlassian.user.impl.ldap.LDAPGroupFactory} implementation. Both adaptors
10   * and factories are configurable, so they can be replaced at any time by another implementation.
11   * <p>
12   *
13   * Doing this will allow implementors to pull group information from LDAP systems and then
14   * construct them into {@link Group} objects however they wish.
15   */
16  
17  import com.atlassian.user.EntityException;
18  import com.atlassian.user.Group;
19  import com.atlassian.user.User;
20  import com.atlassian.user.impl.RepositoryException;
21  import com.atlassian.user.impl.ldap.search.LDAPPagerInfo;
22  import com.atlassian.user.search.page.Pager;
23  import net.sf.ldaptemplate.support.filter.Filter;
24  
25  public interface LDAPGroupAdaptor
26  {
27      Group getGroup(String name) throws EntityException;
28  
29      /**
30       * @return A {@link Pager} holding containing a {@link Group} for each group the user belongs to. An empty pager
31       * will be returned if the user does not belong to any groups that this manager knows about.
32       */
33      Pager<Group> getGroups(User user) throws EntityException;
34  
35      Pager<Group> getGroups() throws EntityException;
36  
37      Pager<String> findMembers(Group group) throws EntityException;
38  
39      Pager<String> findMemberNames(Group group) throws EntityException;
40  
41      boolean hasStaticGroups();
42  
43      String getGroupDN(Group group) throws EntityException;
44  
45      String getGroupDN(String group) throws EntityException;
46  
47      boolean hasMembership(Group group, User user) throws EntityException;
48  
49      LDAPPagerInfo getGroupEntries() throws EntityException;
50  
51      /**
52       * If groupName is <code>null</code>, returns all groups.
53       */
54      LDAPPagerInfo getGroupEntries(String groupName) throws EntityException;
55  
56      LDAPPagerInfo getGroupEntries(String[] attributesToReturn, Filter additionalSearchFilter) throws EntityException;
57  
58      LDAPPagerInfo getGroupEntries(String groupName, String[] attributesToReturn, Filter additionalSearchFilter)
59              throws EntityException;
60  
61      LDAPPagerInfo getGroupEntriesViaMembership(User user) throws EntityException;
62  
63      LDAPPagerInfo getGroupEntriesViaMembership(String username) throws EntityException;
64  
65      LDAPPagerInfo getGroupEntriesViaMembership(String username, String[] attributesToReturn) throws EntityException;
66  
67      /**
68       * @return an {@link com.atlassian.user.impl.ldap.search.LDAPPagerInfo} holding the search query used, the result, and the original base context.
69       * @throws com.atlassian.user.impl.RepositoryException
70       */
71      LDAPPagerInfo search(Filter searchFilter) throws RepositoryException;
72  }