com.atlassian.user.impl.memory
Class MemoryGroupManagerReadOnly

java.lang.Object
  extended bycom.atlassian.user.impl.ReadOnlyGroupManager
      extended bycom.atlassian.user.impl.memory.MemoryGroupManagerReadOnly
All Implemented Interfaces:
EntityManager, GroupManager

public class MemoryGroupManagerReadOnly
extends ReadOnlyGroupManager


Constructor Summary
MemoryGroupManagerReadOnly(RepositoryIdentifier config, MemoryProvider provider)
           
 
Method Summary
 Pager getExternalMemberNames(Group group)
          Retrieves the names of those members of the specified group which are stored in another repository.
 Group getGroup(java.lang.String groupName)
          Retrieves the group with the given name.
 Pager getGroups()
          Retrieves all groups in this repository.
 Pager getGroups(User user)
          Retrieves the groups to which the given user belongs.
 RepositoryIdentifier getIdentifier()
           
 Pager getLocalMemberNames(Group group)
          Retrieves the names of those members of the specified group which are also stored in this repository.
 Pager getMemberNames(Group group)
          Retrieves the names of all members of the specified group.
 RepositoryIdentifier getRepository(Entity entity)
           
 boolean hasMembership(Group group, User user)
          Returns true if the user is a member of the specified group.
 void setUserManager(UserManager userManager)
           
 boolean supportsExternalMembership()
          Returns true if the repository supports users in other repositories being members of groups in this repository.
 
Methods inherited from class com.atlassian.user.impl.ReadOnlyGroupManager
addMembership, createGroup, getWritableGroups, isCreative, isReadOnly, removeGroup, removeMembership, saveGroup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemoryGroupManagerReadOnly

public MemoryGroupManagerReadOnly(RepositoryIdentifier config,
                                  MemoryProvider provider)
Method Detail

getGroups

public Pager getGroups()
Description copied from interface: GroupManager
Retrieves all groups in this repository.

Returns:
a Pager containing a Group for each group managed by the repository. An empty pager will be returned if the repository does not contain any groups.

hasMembership

public boolean hasMembership(Group group,
                             User user)
Description copied from interface: GroupManager
Returns true if the user is a member of the specified group.

If the user is not in this repository, and GroupManager.supportsExternalMembership() returns true, external members will be checked as well.

If the group is not handled by this manager, returns false.

Returns:
true if the user is a member of the specified group, otherwise false.

supportsExternalMembership

public boolean supportsExternalMembership()
                                   throws EntityException
Description copied from interface: GroupManager
Returns true if the repository supports users in other repositories being members of groups in this repository.

Typically this is true of an application-specific Hibernate repository, but not of a company's LDAP server. It is designed to allow the LDAP users to be members of the application's groups for flexible application-level security.

Specified by:
supportsExternalMembership in interface GroupManager
Overrides:
supportsExternalMembership in class ReadOnlyGroupManager
Throws:
EntityException

getGroup

public Group getGroup(java.lang.String groupName)
Description copied from interface: GroupManager
Retrieves the group with the given name. Returns null if the group does not exist in this repository.

Returns:
a Group or null if the group does not exist.

getGroups

public Pager getGroups(User user)
Description copied from interface: GroupManager
Retrieves the groups to which the given user belongs. Only groups which are managed by this repository are included.

Returns:
a Pager containing a Group for each group the user belongs to. An empty pager will be returned if the user does not belong to any groups that this manager knows about.

setUserManager

public void setUserManager(UserManager userManager)

getMemberNames

public Pager getMemberNames(Group group)
Description copied from interface: GroupManager
Retrieves the names of all members of the specified group. The names are ordered by a Collator for the JVM's default locale (as returned by Collator.getInstance().

Returns:
a Pager containing a String with the name of each member of the group. An empty pager will be returned if the group has no members.

getLocalMemberNames

public Pager getLocalMemberNames(Group group)
                          throws EntityException
Description copied from interface: GroupManager
Retrieves the names of those members of the specified group which are also stored in this repository. The names are ordered by a Collator for the JVM's default locale (as returned by Collator.getInstance().

If GroupManager.supportsExternalMembership() returns false, this call is equivalent to GroupManager.getMemberNames(Group).

Returns:
a Pager containing a String with the name of each member of the group which is stored in the same repository. An empty pager will be returned if the group has no local members.
Throws:
EntityException

getExternalMemberNames

public Pager getExternalMemberNames(Group group)
                             throws EntityException
Description copied from interface: GroupManager
Retrieves the names of those members of the specified group which are stored in another repository. For example, an LDAP user which is a member of a Hibernate group is an external member of the Hibernate group.

The names are ordered by a Collator for the JVM's default locale (as returned by Collator.getInstance().

If GroupManager.supportsExternalMembership() returns false, this method throws UnsupportedOperationException.

Returns:
a Pager containing a String with the name of each member of the group which is stored in a different repository. An empty pager will be returned if the group has no external members.
Throws:
EntityException

getIdentifier

public RepositoryIdentifier getIdentifier()
Returns:
the RepositoryIdentifier which is managed by this instance.

getRepository

public RepositoryIdentifier getRepository(Entity entity)
                                   throws EntityException
Returns:
the RepositoryIdentifier of the repository in which the entity is stored, or null if the entity cannot be found.
Throws:
EntityException - if the entity cannot be found, or trying to retrieve it results in an error


Copyright © 2005-2008 Atlassian Software Systems Pty Ltd. All Rights Reserved.