|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atlassian.user.impl.osuser.OSUEntityManager
com.atlassian.user.impl.osuser.OSUGroupManager
public class OSUGroupManager
An adaptor class for AccessProvider and some of the higher level operations of
UserManager
| Field Summary | |
|---|---|
protected org.apache.log4j.Logger |
log
|
| Fields inherited from class com.atlassian.user.impl.osuser.OSUEntityManager |
|---|
repository |
| Constructor Summary | |
|---|---|
OSUGroupManager(RepositoryIdentifier repository,
OSUAccessor accessor)
|
|
| Method Summary | |
|---|---|
void |
addMembership(Group group,
User user)
Adds the user to the specified group. |
Group |
createGroup(String groupName)
Create a new group with the specified name. |
Pager<String> |
getExternalMemberNames(Group group)
Retrieves the names of those members of the specified group which are stored in another repository. |
Group |
getGroup(String groupName)
Retrieves the group with the given name. |
Pager<Group> |
getGroups()
Retrieves all groups in this repository. |
Pager<Group> |
getGroups(User user)
Retrieves the groups to which the given user belongs. |
RepositoryIdentifier |
getIdentifier()
|
Pager<String> |
getLocalMemberNames(Group group)
Retrieves the names of those members of the specified group which are also stored in this repository. |
Pager<String> |
getMemberNames(Group group)
Retrieves the names of all members of the specified group. |
RepositoryIdentifier |
getRepository(Entity entity)
|
List<Group> |
getWritableGroups()
Gets all editable groups. |
boolean |
hasMembership(Group group,
User user)
Returns true if the user is a member of the specified group. |
boolean |
isCreative()
Used to detemine whether an entity can be created (eg, can call UserManager.createUser(String) or
GroupManager.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 com.atlassian.user.impl.osuser.OSUEntityManager |
|---|
getConfiguration |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final org.apache.log4j.Logger log
| Constructor Detail |
|---|
public OSUGroupManager(RepositoryIdentifier repository,
OSUAccessor accessor)
| Method Detail |
|---|
public Pager<Group> getGroups()
GroupManager
getGroups in interface GroupManagerPager containing a Group for each group managed
by the repository. An empty pager will be returned if the repository does
not contain any groups.
public Group createGroup(String groupName)
throws EntityException
GroupManager
createGroup in interface GroupManagerDuplicateEntityException - if a group with the provided name already exists.
EntityException - if the Group could not be created.
public void removeGroup(Group group)
throws EntityException,
IllegalArgumentException
GroupManagerIllegalArgumentException 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.
removeGroup in interface GroupManagerEntityException - if the Group could not be removed.
IllegalArgumentException
public void addMembership(Group group,
User user)
GroupManagerGroupManager.supportsExternalMembership()
returns true, the user will be added as an external user.
addMembership in interface GroupManager
public boolean hasMembership(Group group,
User user)
GroupManagerGroupManager.supportsExternalMembership()
returns true, external members will be checked as well.
If the group is not handled by this manager, returns false.
hasMembership in interface GroupManager
public void removeMembership(Group group,
User user)
GroupManager
removeMembership in interface GroupManager
public boolean isReadOnly(Group group)
throws EntityException
GroupManagertrue 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.
isReadOnly in interface GroupManagerEntityException
public boolean supportsExternalMembership()
throws EntityException
GroupManagertrue 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.
supportsExternalMembership in interface GroupManagerEntityException
public Pager<String> getMemberNames(Group group)
throws EntityException
GroupManagerCollator.getInstance().
getMemberNames in interface GroupManagerPager containing a String with the name of each
member of the group. An empty pager will be returned if the group has no
members.
EntityException
public Pager<String> getLocalMemberNames(Group group)
throws EntityException
GroupManagerCollator.getInstance().
If GroupManager.supportsExternalMembership() returns false, this
call is equivalent to GroupManager.getMemberNames(Group).
getLocalMemberNames in interface GroupManagerPager 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.
EntityException
public Pager<String> getExternalMemberNames(Group group)
throws EntityException
GroupManagerCollator.getInstance().
If GroupManager.supportsExternalMembership() returns false, this
method throws UnsupportedOperationException.
getExternalMemberNames in interface GroupManagerPager 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.
EntityException
public void saveGroup(Group group)
throws EntityException
EntityExceptionpublic Group getGroup(String groupName)
GroupManagernull if the
group does not exist in this repository.
getGroup in interface GroupManagerGroup or null if the group does not exist.
public Pager<Group> getGroups(User user)
throws RepositoryException
GroupManager
getGroups in interface GroupManagerPager 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.
RepositoryExceptionpublic List<Group> getWritableGroups()
GroupManager
getWritableGroups in interface GroupManagerGroups that can be edited.public RepositoryIdentifier getIdentifier()
getIdentifier in interface EntityManagergetIdentifier in class OSUEntityManagerRepositoryIdentifier which is managed by this instance.
public RepositoryIdentifier getRepository(Entity entity)
throws EntityException
getRepository in interface EntityManagerRepositoryIdentifier of the repository in which the entity is stored, or null
if the entity cannot be found.
EntityException - if the entity cannot be found, or trying to retrieve it results in an errorpublic boolean isCreative()
EntityManagerUserManager.createUser(String) or
GroupManager.createGroup(String).
isCreative in interface EntityManagerisCreative in class OSUEntityManagerUserProvider then applied to
the entity produced (here a Group).
All providers in the base OSUUser package are hardcoded to be mutable. This implementation returns the
mutability value of the first group returned by UserProvider.list().
If there are no groups it returns true.
Thus, if you want immutable groups you should override this method or ensure that there is at least one
entity which is handled by the provider. All groups should have the same mutability value.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||