|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A group manager is responsible for all CRUD operations on groups and group
memberships in a given repository.
Where an operation requires a 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.
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. |
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. |
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. |
boolean |
hasMembership(Group group,
User user)
Returns true if the user is a member of the specified group. |
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. |
boolean |
supportsExternalMembership()
Returns true if the repository supports users in other
repositories being members of groups in this repository. |
Methods inherited from interface com.atlassian.user.EntityManager |
getIdentifier, getRepository, isCreative |
Method Detail |
public Pager getGroups() throws EntityException
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.
EntityException
public Pager getGroups(User user) throws EntityException
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.
EntityException
public Pager getMemberNames(Group group) throws EntityException
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.
EntityException
public Pager getLocalMemberNames(Group group) throws EntityException
supportsExternalMembership()
returns false
, this
call is equivalent to getMemberNames(Group)
.
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.
EntityException
public Pager getExternalMemberNames(Group group) throws EntityException
supportsExternalMembership()
returns false
, this
method throws UnsupportedOperationException
.
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.
java.lang.UnsupportedOperationException
- if supportsExternalMembership()
returns false
.
EntityException
public Group getGroup(java.lang.String groupName) throws EntityException
null
if the
group does not exist in this repository.
Group
or null if the group does not exist.
EntityException
public Group createGroup(java.lang.String groupName) throws EntityException
EntityException
- if the Group
could not be created.
java.lang.UnsupportedOperationException
- if EntityManager.isCreative()
returns falsepublic void removeGroup(Group group) throws 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.
EntityException
- if the Group
could not be removed.
java.lang.UnsupportedOperationException
- if isReadOnly(Group)
returns true.public void addMembership(Group group, User user) throws EntityException
supportsExternalMembership()
returns true
, the user will be added as an external user.
java.lang.UnsupportedOperationException
- if isReadOnly(Group)
returns true.
EntityException
public boolean hasMembership(Group group, User user) throws EntityException
supportsExternalMembership()
returns true
, external members will be checked as well.
EntityException
public void removeMembership(Group group, User user) throws EntityException
EntityException
- if the membership could not be removed.
java.lang.UnsupportedOperationException
- if isReadOnly(Group)
returns true.public boolean supportsExternalMembership() throws 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.
EntityException
public boolean isReadOnly(Group group) throws 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
.
EntityException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |