public class UserManagerServiceImpl extends SecuredTreeDBManagerImpl<AbstractUserManagerNode> implements UserManagerService
MODULE_NAME, SECUREE_ID
Constructor and Description |
---|
UserManagerServiceImpl(TreeDBService treeDB,
<any> entityManagerProvider,
PasswordHasher passwordHasher,
HookHandlerService hookHandlerService) |
Modifier and Type | Method and Description |
---|---|
void |
changePassword(java.lang.String username,
java.lang.String oldPassword,
java.lang.String newPassword) |
void |
changePassword(User user,
java.lang.String oldPassword,
java.lang.String newPassword) |
void |
forceRemove(AbstractUserManagerNode node)
Removes the node and takes care of database constraints.
|
java.util.Collection<Group> |
getAllGroups()
Returns a
Collection of all existing Group s |
java.util.List<AbstractUserManagerNode> |
getAllNodes() |
java.util.Collection<OrganisationalUnit> |
getAllOUs() |
java.util.Set<User> |
getAllTransitiveUsers(AbstractUserManagerNode node)
Returns all users underneath the node.
|
java.util.Collection<User> |
getAllUsers()
Returns a
Collection of all existing User s |
java.util.Collection<Group> |
getDirectGroups(User user)
Returns groups in which the user is a direct member.
|
Group |
getGroupByName(java.lang.String name)
Finds a
Group by name |
java.util.Set<Group> |
getGroups(java.util.Collection<java.lang.Long> ids)
|
java.util.List<Group> |
getGroupsWithMember(Group group) |
java.util.List<Group> |
getGroupsWithMember(OrganisationalUnit ou) |
java.util.Collection<Group> |
getIndirectGroups(User user)
Returns groups in which the user is an indirect member.
|
AbstractUserManagerNode |
getNodeById(long id)
Searches for a
AbstractUserManagerNode by its id |
long |
getNumberOfActiveUsers()
Returns the number of active users in the system, that is, not inhibited and
not with accounts not expired.
|
long |
getNumberOfExpiredUsers() |
long |
getNumberOfInhibitedUsers() |
java.util.Set<OrganisationalUnit> |
getOUs(java.util.Collection<java.lang.Long> ids) |
java.util.List<OrganisationalUnit> |
getOUsByName(java.lang.String name)
Searches for a
OrganisationalUnit by its name |
java.util.Collection<Group> |
getReferencedGroups(User user)
Returns all groups in which the user is a direct or indirect member.
|
java.util.List<AbstractUserManagerNode> |
getRoots() |
User |
getUserByMail(java.lang.String email)
Finds a
User by email |
User |
getUserByName(java.lang.String name)
Finds a
User by name |
User |
getUserOrNull(java.lang.String username) |
java.util.Set<User> |
getUsers(java.util.Collection<java.lang.Long> ids)
|
java.util.Set<User> |
getUsers(java.util.Collection<java.lang.Long> ids,
boolean dereferenceGroups)
Returns
User objects for all given IDs (be they user or group) |
java.util.Collection<User> |
getUsersByMail(java.lang.String email) |
void |
remove(AbstractUserManagerNode node)
Removes the node and takes care of database constraints.
|
void |
setPassword(User user,
java.lang.String newPassword)
Sets the
User s password |
boolean |
userInFolk(User user,
AbstractUserManagerNode folk)
Tests whether the submitted
User is part of the folk. |
boolean |
userInFolk(User user,
AbstractUserManagerNode folk,
java.util.Set<Group> seenGroups) |
copy, getVirtualRoots, move, move, move, move, persist
merge
allowsMultipleRoots, copy, getBaseType, getChildrenWithName, isFolder, updateFlags
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
merge, persist
allowsMultipleRoots, copy, getBaseType, getChildrenWithName, getVirtualRoots, isFolder, move, move, updateFlags
public UserManagerServiceImpl(TreeDBService treeDB, <any> entityManagerProvider, PasswordHasher passwordHasher, HookHandlerService hookHandlerService)
@QueryByAttribute(where=<error>) public User getUserByName(java.lang.String name)
UserManagerService
User
by namegetUserByName
in interface UserManagerService
name
- The User
's nameUser
public java.util.Collection<User> getUsersByMail(java.lang.String email)
getUsersByMail
in interface UserManagerService
public User getUserByMail(java.lang.String email)
UserManagerService
User
by emailgetUserByMail
in interface UserManagerService
User
@QueryByAttribute(where=<error>) public Group getGroupByName(java.lang.String name)
UserManagerService
Group
by namegetGroupByName
in interface UserManagerService
name
- The Group
's nameGroup
@QueryByAttribute(where=<error>) public java.util.List<OrganisationalUnit> getOUsByName(java.lang.String name)
UserManagerService
OrganisationalUnit
by its namegetOUsByName
in interface UserManagerService
name
- The name of the OrganisationalUnit
OrganisationalUnit
public void remove(AbstractUserManagerNode node)
remove
in interface UserManagerService
remove
in interface TreeDBManager<AbstractUserManagerNode>
remove
in class SecuredTreeDBManagerImpl<AbstractUserManagerNode>
node
- AbstractUserManagerNode
public void forceRemove(AbstractUserManagerNode node)
forceRemove
in interface TreeDBManager<AbstractUserManagerNode>
forceRemove
in class SecuredTreeDBManagerImpl<AbstractUserManagerNode>
@QueryByAttribute(where=<error>, type=IS_MEMBER) public java.util.List<Group> getGroupsWithMember(Group group)
getGroupsWithMember
in interface UserManagerService
@QueryByAttribute(where=<error>, type=IS_MEMBER) public java.util.List<Group> getGroupsWithMember(OrganisationalUnit ou)
getGroupsWithMember
in interface UserManagerService
public boolean userInFolk(User user, AbstractUserManagerNode folk)
UserManagerService
User
is part of the folk.userInFolk
in interface UserManagerService
user
- The User
to testfolk
- The AbstractUserManagerNode
(the folk)User
is part of folk; false otherwisepublic boolean userInFolk(User user, AbstractUserManagerNode folk, java.util.Set<Group> seenGroups)
public java.util.Collection<Group> getReferencedGroups(User user)
UserManagerService
getReferencedGroups
in interface UserManagerService
user
- the user to fetch all groups from@SimpleQuery public java.util.Collection<Group> getAllGroups()
UserManagerService
Collection
of all existing Group
sgetAllGroups
in interface UserManagerService
Collection
of Group
s@SimpleQuery public java.util.Collection<OrganisationalUnit> getAllOUs()
getAllOUs
in interface UserManagerService
@SimpleQuery public java.util.Collection<User> getAllUsers()
UserManagerService
Collection
of all existing User
sgetAllUsers
in interface UserManagerService
Collection
of User
spublic java.util.Set<User> getUsers(java.util.Collection<java.lang.Long> ids)
UserManagerService
getUsers
in interface UserManagerService
ids
- A Collection
of Long
sSet
of User
spublic java.util.Set<User> getUsers(java.util.Collection<java.lang.Long> ids, boolean dereferenceGroups)
UserManagerService
User
objects for all given IDs (be they user or group)getUsers
in interface UserManagerService
ids
- A Collection
of Long
s containing the
IDsdereferenceGroups
- Set to true if the result should contain
groupsSet
of User
spublic java.util.Set<Group> getGroups(java.util.Collection<java.lang.Long> ids)
UserManagerService
getGroups
in interface UserManagerService
ids
- A Collection
of Long
sSet
of Group
spublic void setPassword(User user, java.lang.String newPassword)
UserManagerService
User
s passwordsetPassword
in interface UserManagerService
user
- The User
newPassword
- The new passwordpublic void changePassword(User user, java.lang.String oldPassword, java.lang.String newPassword) throws ExpectedException
changePassword
in interface UserManagerService
ExpectedException
public void changePassword(java.lang.String username, java.lang.String oldPassword, java.lang.String newPassword) throws ExpectedException
changePassword
in interface UserManagerService
ExpectedException
@QueryByAttribute(where=<error>, type=IS_NULL) public java.util.List<AbstractUserManagerNode> getRoots()
getRoots
in interface TreeDBManager<AbstractUserManagerNode>
@SimpleQuery public java.util.List<AbstractUserManagerNode> getAllNodes()
getAllNodes
in interface TreeDBManager<AbstractUserManagerNode>
@QueryById public AbstractUserManagerNode getNodeById(long id)
UserManagerService
AbstractUserManagerNode
by its idgetNodeById
in interface UserManagerService
getNodeById
in interface TreeDBManager<AbstractUserManagerNode>
id
- The IDAbstractUserManagerNode
identified by the given IDpublic java.util.Set<User> getAllTransitiveUsers(AbstractUserManagerNode node)
UserManagerService
getAllTransitiveUsers
in interface UserManagerService
public java.util.Set<OrganisationalUnit> getOUs(java.util.Collection<java.lang.Long> ids)
getOUs
in interface UserManagerService
public java.util.Collection<Group> getDirectGroups(User user)
UserManagerService
getDirectGroups
in interface UserManagerService
user
- the user to fetch direct groups frompublic java.util.Collection<Group> getIndirectGroups(User user)
UserManagerService
getIndirectGroups
in interface UserManagerService
user
- the user to fetch indirect groups frompublic User getUserOrNull(java.lang.String username)
getUserOrNull
in interface UserManagerService
public long getNumberOfActiveUsers()
UserManagerService
getNumberOfActiveUsers
in interface UserManagerService
public long getNumberOfInhibitedUsers()
getNumberOfInhibitedUsers
in interface UserManagerService
public long getNumberOfExpiredUsers()
getNumberOfExpiredUsers
in interface UserManagerService