public class CrowdGroupManager extends Object implements com.atlassian.user.GroupManager
Group
as an argument, calling the
method with a group from another repository will typically throw an
IllegalArgumentException
.
The group manager is responsible for ensuring the consistency of the underlying
repository where relevant. For example, if membership information needs to be
updated as part of the removeGroup(Group)
operation, the group manager
is responsible for ensuring it happens.
This interface is an extension of the EntityManager
interface which
is common to user and group management. The common functionality includes
initialisation and access to the repository description.Constructor and Description |
---|
CrowdGroupManager(com.atlassian.user.repository.RepositoryIdentifier repositoryIdentifier)
Configures to the Crowd client cache for better performance.
|
CrowdGroupManager(com.atlassian.user.repository.RepositoryIdentifier repositoryIdentifier,
GroupManager groupManager,
GroupMembershipManager groupMembershipManager) |
Modifier and Type | Method and Description |
---|---|
void |
addMembership(com.atlassian.user.Group group,
com.atlassian.user.User user)
Adds the user to the specified group.
|
protected List |
convertStringsToGroups(List groupNames)
Converts a List
|
com.atlassian.user.Group |
createGroup(String name)
Create a new group with the specified name.
|
protected List |
getAllGroups() |
com.atlassian.user.search.page.Pager |
getExternalMemberNames(com.atlassian.user.Group group)
|
com.atlassian.user.Group |
getGroup(String name)
Retrieves the group with the given name.
|
protected List |
getGroupMemberships(com.atlassian.user.User user)
Retrieves the groups to which the given user belongs.
|
com.atlassian.user.search.page.Pager |
getGroups()
Retrieves all groups in this repository.
|
com.atlassian.user.search.page.Pager |
getGroups(com.atlassian.user.User user)
Retrieves the groups to which the given user belongs.
|
com.atlassian.user.repository.RepositoryIdentifier |
getIdentifier()
Returns information about the respository implementation.
|
com.atlassian.user.search.page.Pager |
getLocalMemberNames(com.atlassian.user.Group group)
Retrieves the names of those members of the specified group which are also
stored in this repository.
|
com.atlassian.user.search.page.Pager |
getMemberNames(com.atlassian.user.Group group)
Retrieves the names of all members of the specified group.
|
com.atlassian.user.repository.RepositoryIdentifier |
getRepository(com.atlassian.user.Entity entity)
Returns information about the respository for a specific entity.
|
List |
getWritableGroups()
Gets all editable groups.
|
boolean |
hasMembership(com.atlassian.user.Group group,
com.atlassian.user.User user)
Returns true if the user is a member of the specified group.
|
boolean |
isCreative() |
boolean |
isReadOnly(com.atlassian.user.Group group)
Returns
true if the specified group and membership of the
specified group cannot be modified in the repository. |
void |
removeGroup(com.atlassian.user.Group group)
Remove the group specified, if it exists in this repository.
|
void |
removeMembership(com.atlassian.user.Group group,
com.atlassian.user.User user)
Removes the user from the specified group.
|
boolean |
supportsExternalMembership()
Returns
true if the repository supports users in other
repositories being members of groups in this repository. |
public CrowdGroupManager(com.atlassian.user.repository.RepositoryIdentifier repositoryIdentifier)
repositoryIdentifier
- repository ID.public CrowdGroupManager(com.atlassian.user.repository.RepositoryIdentifier repositoryIdentifier, GroupManager groupManager, GroupMembershipManager groupMembershipManager)
protected List getAllGroups() throws InvalidAuthorizationTokenException, RemoteException, InvalidAuthenticationException
protected List convertStringsToGroups(List groupNames)
groupNames
is null or empty. See the contract of GroupManager.getGroups()
.groupNames
- public com.atlassian.user.search.page.Pager getGroups() throws com.atlassian.user.EntityException
getGroups
in interface com.atlassian.user.GroupManager
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.com.atlassian.user.EntityException
public List getWritableGroups()
getWritableGroups
in interface com.atlassian.user.GroupManager
Group
s that can be edited.public com.atlassian.user.search.page.Pager getGroups(com.atlassian.user.User user) throws com.atlassian.user.EntityException
getGroups
in interface com.atlassian.user.GroupManager
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.com.atlassian.user.EntityException
protected List getGroupMemberships(com.atlassian.user.User user) throws com.atlassian.user.EntityException
List
containing a Group
for each group the user
belongs to. An empty list will be returned if the user does not belong to
any groups that this manager knows about.com.atlassian.user.EntityException
public com.atlassian.user.search.page.Pager getMemberNames(com.atlassian.user.Group group) throws com.atlassian.user.EntityException
getMemberNames
in interface com.atlassian.user.GroupManager
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.com.atlassian.user.EntityException
public com.atlassian.user.search.page.Pager getLocalMemberNames(com.atlassian.user.Group group) throws com.atlassian.user.EntityException
supportsExternalMembership()
returns false
, this
call is equivalent to getMemberNames(Group)
.getLocalMemberNames
in interface com.atlassian.user.GroupManager
group
- The group to lookup.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.com.atlassian.user.EntityException
public com.atlassian.user.search.page.Pager getExternalMemberNames(com.atlassian.user.Group group) throws com.atlassian.user.EntityException
getExternalMemberNames
in interface com.atlassian.user.GroupManager
group
- The group to lookup.com.atlassian.user.EntityException
- Search exception.public com.atlassian.user.Group getGroup(String name) throws com.atlassian.user.EntityException
null
if the
group does not exist in this repository.getGroup
in interface com.atlassian.user.GroupManager
Group
or null if the group does not exist.com.atlassian.user.EntityException
public com.atlassian.user.Group createGroup(String name) throws com.atlassian.user.EntityException
createGroup
in interface com.atlassian.user.GroupManager
com.atlassian.user.EntityException
- if the Group
could not be created.UnsupportedOperationException
- if isCreative()
returns falsepublic void removeGroup(com.atlassian.user.Group group) throws com.atlassian.user.EntityException
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.removeGroup
in interface com.atlassian.user.GroupManager
com.atlassian.user.EntityException
- if the Group
could not be removed.UnsupportedOperationException
- if isReadOnly(Group)
returns true.public void addMembership(com.atlassian.user.Group group, com.atlassian.user.User user) throws com.atlassian.user.EntityException
supportsExternalMembership()
returns true
, the user will be added as an external user.addMembership
in interface com.atlassian.user.GroupManager
UnsupportedOperationException
- if isReadOnly(Group)
returns true.com.atlassian.user.EntityException
public boolean hasMembership(com.atlassian.user.Group group, com.atlassian.user.User user) throws com.atlassian.user.EntityException
supportsExternalMembership()
returns true
, external members will be checked as well.hasMembership
in interface com.atlassian.user.GroupManager
com.atlassian.user.EntityException
public void removeMembership(com.atlassian.user.Group group, com.atlassian.user.User user) throws com.atlassian.user.EntityException
removeMembership
in interface com.atlassian.user.GroupManager
com.atlassian.user.EntityException
- if the membership could not be removed.UnsupportedOperationException
- if GroupManager.isReadOnly(Group)
returns true.public boolean supportsExternalMembership() throws com.atlassian.user.EntityException
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.supportsExternalMembership
in interface com.atlassian.user.GroupManager
com.atlassian.user.EntityException
public boolean isReadOnly(com.atlassian.user.Group group) throws com.atlassian.user.EntityException
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
.isReadOnly
in interface com.atlassian.user.GroupManager
com.atlassian.user.EntityException
public com.atlassian.user.repository.RepositoryIdentifier getIdentifier()
getIdentifier
in interface com.atlassian.user.EntityManager
public com.atlassian.user.repository.RepositoryIdentifier getRepository(com.atlassian.user.Entity entity) throws com.atlassian.user.EntityException
getRepository
in interface com.atlassian.user.EntityManager
entity
- The entity.com.atlassian.user.EntityException
public boolean isCreative()
isCreative
in interface com.atlassian.user.EntityManager
Copyright © 2013 Atlassian. All Rights Reserved.