com.atlassian.user.impl
Class ReadOnlyGroupManager

java.lang.Object
  extended bycom.atlassian.user.impl.ReadOnlyGroupManager
All Implemented Interfaces:
EntityManager, GroupManager
Direct Known Subclasses:
LDAPGroupManagerReadOnly, MemoryGroupManagerReadOnly

public abstract class ReadOnlyGroupManager
extends java.lang.Object
implements GroupManager


Constructor Summary
ReadOnlyGroupManager()
           
 
Method Summary
 void addMembership(Group group, User user)
          Adds the user to the specified group.
 Group createGroup(java.lang.String groupName)
          Create a new group with the specified name.
 java.util.List getWritableGroups()
          Gets all editable groups.
 boolean isCreative()
          Used to detemine whether an entity can be added (eg, can call UserManager.createUser(String) orGroupManager.createGroup(String)
 boolean isReadOnly(Group group)
          Returns true if the specified group and membership of the specified group cannot be modified in the repository.
 void removeGroup(Group group)
          Remove the group specified, if it exists in this repository.
 void removeMembership(Group group, User user)
          Removes the user from the specified group.
 void saveGroup(Group group)
           
 boolean supportsExternalMembership()
          Returns true if the repository supports users in other repositories being members of groups in this repository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.user.GroupManager
getExternalMemberNames, getGroup, getGroups, getGroups, getLocalMemberNames, getMemberNames, hasMembership
 
Methods inherited from interface com.atlassian.user.EntityManager
getIdentifier, getRepository
 

Constructor Detail

ReadOnlyGroupManager

public ReadOnlyGroupManager()
Method Detail

getWritableGroups

public java.util.List getWritableGroups()
Description copied from interface: GroupManager
Gets all editable groups. That is, returns any groups that belong to read/write repositories. Groups in readonly repositories that are ReadOnly are not returned.

Specified by:
getWritableGroups in interface GroupManager
Returns:
list of Groups that can be edited.

createGroup

public Group createGroup(java.lang.String groupName)
                  throws EntityException
Description copied from interface: GroupManager
Create a new group with the specified name.

Specified by:
createGroup in interface GroupManager
Throws:
EntityException - if the Group could not be created.

removeGroup

public void removeGroup(Group group)
                 throws EntityException
Description copied from interface: GroupManager
Remove the group specified, if it exists in this repository. If the group does not belong to this repository, an IllegalArgumentException will be thrown. If required to maintain the consistency of the repository, the group manager should remove users from the group before removing the group itself.

Specified by:
removeGroup in interface GroupManager
Throws:
EntityException - if the Group could not be removed.

saveGroup

public void saveGroup(Group group)
               throws EntityException
Throws:
EntityException

addMembership

public void addMembership(Group group,
                          User user)
                   throws EntityException
Description copied from interface: GroupManager
Adds the user to the specified group.

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

Specified by:
addMembership in interface GroupManager
Throws:
EntityException

removeMembership

public void removeMembership(Group group,
                             User user)
                      throws EntityException
Description copied from interface: GroupManager
Removes the user from the specified group.

Specified by:
removeMembership in interface GroupManager
Throws:
EntityException - if the membership could not be removed.

isCreative

public boolean isCreative()
Used to detemine whether an entity can be added (eg, can call UserManager.createUser(String) orGroupManager.createGroup(String)

Specified by:
isCreative in interface EntityManager
Returns:
true to indicate that Entity objects can be created by this manager, or false to indicate not.

isReadOnly

public boolean isReadOnly(Group group)
Description copied from interface: GroupManager
Returns true if the specified group and membership of the specified group cannot be modified in the repository.

If this returns true, invoking methods which attempt to modify the group or membership of the group will fail with UnsupportedOperationException.

Specified by:
isReadOnly in interface GroupManager
Returns:
true if the group and membership of the group cannot be modified, 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
Returns:
true if users from other repositories can be granted membership to groups in this repository, otherwise false.
Throws:
EntityException


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