|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.dao.support.DaoSupport org.springframework.orm.hibernate.support.HibernateDaoSupport com.atlassian.user.impl.hibernate.HibernateGroupManager
A HibernateGroupManager which handles membership for local and external entities.
Field Summary | |
static java.lang.String |
ENTITYID_FIELD
|
static java.lang.String |
EXTERNAL_ENTITY_NAME_FIELD
|
protected ExternalEntityDAO |
externalEntityDao
|
static java.lang.String |
GROUPID_FIELD
|
static java.lang.String |
GROUPNAME_FIELD
|
protected HibernateRepository |
repository
|
protected UserManager |
userManager
|
Fields inherited from class org.springframework.dao.support.DaoSupport |
logger |
Constructor Summary | |
HibernateGroupManager(RepositoryIdentifier identifier,
HibernateRepository repository,
UserManager userManager,
ExternalEntityDAO externalEntityDao)
|
Method Summary | |
void |
addMembership(Group group,
User user)
Adds the user to the specified group. |
protected ExternalEntity |
createExternalEntity(User user)
|
Group |
createGroup(java.lang.String groupname)
Create a new group with the specified name. |
protected java.util.Collection |
getAllGroupsForUser(User user)
|
protected ExternalEntity |
getCorrespondingExternalEntity(User user)
|
Pager |
getExternalMemberNames(Group group)
Retrieves the names of those members of the specified group which are stored in another repository. |
Pager |
getExternalMembers(Group group)
|
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. |
protected java.util.List |
getGroupsForExternalEntity(ExternalEntity externalEntity)
|
protected java.util.List |
getGroupsForLocalUser(User user)
|
RepositoryIdentifier |
getIdentifier()
|
Pager |
getLocalMemberNames(Group group)
Retrieves the names of those members of the specified group which are also stored in this repository. |
Pager |
getLocalMembers(Group group)
|
Pager |
getMemberNames(Group group)
Retrieves the names of all members of the specified group. |
RepositoryIdentifier |
getRepository(Entity entity)
|
protected boolean |
hasExternalMembership(DefaultHibernateGroup defGroup,
User user)
|
protected boolean |
hasLocalMembership(DefaultHibernateGroup defGroup,
DefaultHibernateUser defUser)
|
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 added (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. |
protected boolean |
isUserExternal(User user)
for the time being, lets define an internal user as a hibernate user. |
void |
removeGroup(Group group)
Removes the specified group, if it is present. |
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. |
protected void |
validateGroup(Group group)
|
protected void |
validateGroupAndUser(Group group,
User user)
|
Methods inherited from class org.springframework.orm.hibernate.support.HibernateDaoSupport |
checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, setHibernateTemplate, setSessionFactory |
Methods inherited from class org.springframework.dao.support.DaoSupport |
afterPropertiesSet, initDao |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String GROUPNAME_FIELD
public static final java.lang.String GROUPID_FIELD
public static final java.lang.String ENTITYID_FIELD
public static final java.lang.String EXTERNAL_ENTITY_NAME_FIELD
protected final HibernateRepository repository
protected final UserManager userManager
protected final ExternalEntityDAO externalEntityDao
Constructor Detail |
public HibernateGroupManager(RepositoryIdentifier identifier, HibernateRepository repository, UserManager userManager, ExternalEntityDAO externalEntityDao)
Method Detail |
public Pager getGroups() throws EntityException
GroupManager
getGroups
in interface 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.
EntityException
public Pager getGroups(User user) throws EntityException
GroupManager
getGroups
in interface 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.
EntityException
protected java.util.Collection getAllGroupsForUser(User user) throws RepositoryException
RepositoryException
protected boolean isUserExternal(User user)
protected java.util.List getGroupsForLocalUser(User user) throws RepositoryException
RepositoryException
protected java.util.List getGroupsForExternalEntity(ExternalEntity externalEntity) throws RepositoryException
RepositoryException
public Pager getMemberNames(Group group) throws EntityException
GroupManager
getMemberNames
in interface GroupManager
Pager
instance which can hold User
and ExternalEntity
objects.
EntityException
protected void validateGroup(Group group)
public Pager getLocalMemberNames(Group group) throws EntityException
GroupManager
GroupManager.supportsExternalMembership()
returns false
, this
call is equivalent to GroupManager.getMemberNames(Group)
.
getLocalMemberNames
in interface GroupManager
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 getLocalMembers(Group group) throws RepositoryException
RepositoryException
public Pager getExternalMembers(Group group) throws RepositoryException
RepositoryException
public Pager getExternalMemberNames(Group group) throws EntityException
GroupManager
GroupManager.supportsExternalMembership()
returns false
, this
method throws UnsupportedOperationException
.
getExternalMemberNames
in interface GroupManager
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.
EntityException
public Group getGroup(java.lang.String groupname) throws EntityException
GroupManager
null
if the
group does not exist in this repository.
getGroup
in interface GroupManager
Group
or null if the group does not exist.
EntityException
public Group createGroup(java.lang.String groupname) throws EntityException
GroupManager
createGroup
in interface GroupManager
EntityException
- if the Group
could not be created.public void removeGroup(Group group) throws EntityException
removeGroup
in interface GroupManager
EntityException
- - representing the exception which prohibited removalpublic void addMembership(Group group, User user) throws EntityException
GroupManager
GroupManager.supportsExternalMembership()
returns true
, the user will be added as an external user.
addMembership
in interface GroupManager
EntityException
protected ExternalEntity getCorrespondingExternalEntity(User user) throws RepositoryException
RepositoryException
protected ExternalEntity createExternalEntity(User user)
public boolean hasMembership(Group group, User user) throws EntityException
GroupManager
GroupManager.supportsExternalMembership()
returns true
, external members will be checked as well.
hasMembership
in interface GroupManager
EntityException
protected void validateGroupAndUser(Group group, User user) throws EntityException
EntityException
protected boolean hasExternalMembership(DefaultHibernateGroup defGroup, User user) throws EntityException
EntityException
protected boolean hasLocalMembership(DefaultHibernateGroup defGroup, DefaultHibernateUser defUser) throws EntityException
EntityException
public void removeMembership(Group group, User user) throws EntityException
GroupManager
removeMembership
in interface GroupManager
EntityException
- if the membership could not be removed.public boolean isReadOnly(Group group) throws EntityException
GroupManager
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 GroupManager
EntityException
public boolean supportsExternalMembership() throws EntityException
GroupManager
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 GroupManager
EntityException
public RepositoryIdentifier getIdentifier()
getIdentifier
in interface EntityManager
RepositoryIdentifier
which is managed by this instance.public RepositoryIdentifier getRepository(Entity entity) throws EntityException
getRepository
in interface EntityManager
RepositoryIdentifier
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()
UserManager.createUser(String)
or
GroupManager.createGroup(String)
isCreative
in interface EntityManager
Entity
objects can be created by this manager, or false to indicate
not.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |