Class LdapUserManager
- java.lang.Object
-
- org.apache.archiva.redback.users.AbstractUserManager
-
- org.apache.archiva.redback.users.ldap.LdapUserManager
-
- All Implemented Interfaces:
UserManager
@Service("userManager#ldap") public class LdapUserManager extends AbstractUserManager implements UserManager
- Author:
- jesse
-
-
Field Summary
-
Fields inherited from class org.apache.archiva.redback.users.AbstractUserManager
log
-
Fields inherited from interface org.apache.archiva.redback.users.UserManager
GUEST_USERNAME
-
-
Constructor Summary
Constructors Constructor Description LdapUserManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description User
addUser(User user)
Add a User.void
addUserUnchecked(User user)
Add a user to the database without checking for consistency or adjusting the password.User
createUser(String username, String fullName, String emailAddress)
Factory method to create new User Objects based on provider specific implementation.UserQuery
createUserQuery()
Factory method to createUserQuery
s based on provider specific implementations.void
deleteUser(String username)
Delete a user using the username.void
eraseDatabase()
User
findUser(String username)
Find a User using a User name.User
findUser(String username, boolean useCache)
Find a User using a User name.List<User>
findUsersByEmailKey(String emailKey, boolean orderAscending)
List<User>
findUsersByFullNameKey(String fullNameKey, boolean orderAscending)
List<User>
findUsersByQuery(UserQuery query)
Find users matching properties, ordering and range as specified by theUserQuery
.List<User>
findUsersByUsernameKey(String usernameKey, boolean orderAscending)
String
getDescriptionKey()
String
getId()
An Identifier for the UserManager.List<User>
getUsers()
Get the List ofUser
objects.List<User>
getUsers(boolean orderAscending)
void
initialize()
consumer of user manager can use it to reload various configuration with the configurable implementation is possible to change dynamically the real implementation used.boolean
isFinalImplementation()
boolean
isReadOnly()
Is the UserManager read only? if so then create and modify actions are to be disabledUser
updateUser(User user)
Update a User.User
updateUser(User user, boolean passwordChangeRequired)
boolean
userExists(String principal)
true if the user exists, false if it doesn't-
Methods inherited from class org.apache.archiva.redback.users.AbstractUserManager
addUserManagerListener, createGuestUser, fireUserManagerInit, fireUserManagerUserAdded, fireUserManagerUserRemoved, fireUserManagerUserUpdated, getGuestUser, getListeners, removeUserManagerListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.archiva.redback.users.UserManager
addUserManagerListener, createGuestUser, getGuestUser, removeUserManagerListener
-
-
-
-
Constructor Detail
-
LdapUserManager
public LdapUserManager()
-
-
Method Detail
-
initialize
@PostConstruct public void initialize()
Description copied from interface:UserManager
consumer of user manager can use it to reload various configuration with the configurable implementation is possible to change dynamically the real implementation used.- Specified by:
initialize
in interfaceUserManager
- Overrides:
initialize
in classAbstractUserManager
-
isReadOnly
public boolean isReadOnly()
Description copied from interface:UserManager
Is the UserManager read only? if so then create and modify actions are to be disabled- Specified by:
isReadOnly
in interfaceUserManager
- Returns:
- boolean true if user manager is disabled
-
addUser
public User addUser(User user) throws UserManagerException
Description copied from interface:UserManager
Add a User.- Specified by:
addUser
in interfaceUserManager
- Parameters:
user
- the user to add.- Returns:
- the user that was just added.
- Throws:
UserManagerException
-
addUserUnchecked
public void addUserUnchecked(User user) throws UserManagerException
Description copied from interface:UserManager
Add a user to the database without checking for consistency or adjusting the password. Should only be used for re-importing known-good data.- Specified by:
addUserUnchecked
in interfaceUserManager
- Parameters:
user
- the user to add- Throws:
UserManagerException
-
createUser
public User createUser(String username, String fullName, String emailAddress)
Description copied from interface:UserManager
Factory method to create new User Objects based on provider specific implementation. User objects created this way do not exist in the provider's underlying data store until a call toUserManager.addUser(User)
is made.- Specified by:
createUser
in interfaceUserManager
- Parameters:
username
- the username for this user.fullName
- the full name for this user.emailAddress
- the email address for this user.- Returns:
- the new user object ready to use.
-
createUserQuery
public UserQuery createUserQuery()
Description copied from interface:UserManager
Factory method to createUserQuery
s based on provider specific implementations.- Specified by:
createUserQuery
in interfaceUserManager
- Returns:
- the provider implementation of UserQuery
-
deleteUser
public void deleteUser(String username) throws UserNotFoundException, UserManagerException
Description copied from interface:UserManager
Delete a user using the username.- Specified by:
deleteUser
in interfaceUserManager
- Parameters:
username
- the username to look for.- Throws:
UserNotFoundException
- the user was not found.UserManagerException
-
eraseDatabase
public void eraseDatabase()
- Specified by:
eraseDatabase
in interfaceUserManager
-
findUser
public User findUser(String username, boolean useCache) throws UserNotFoundException, UserManagerException
Description copied from interface:UserManager
Find a User using a User name.- Specified by:
findUser
in interfaceUserManager
- Parameters:
username
- the username to find.useCache
- to use or not caching- Returns:
- the user.
- Throws:
UserNotFoundException
- if the user was not found.UserManagerException
-
findUser
public User findUser(String username) throws UserNotFoundException, UserManagerException
Description copied from interface:UserManager
Find a User using a User name.- Specified by:
findUser
in interfaceUserManager
- Parameters:
username
- the username to find.- Returns:
- the user.
- Throws:
UserNotFoundException
- if the user was not found.UserManagerException
-
findUsersByEmailKey
public List<User> findUsersByEmailKey(String emailKey, boolean orderAscending) throws UserManagerException
- Specified by:
findUsersByEmailKey
in interfaceUserManager
- Throws:
UserManagerException
-
findUsersByFullNameKey
public List<User> findUsersByFullNameKey(String fullNameKey, boolean orderAscending) throws UserManagerException
- Specified by:
findUsersByFullNameKey
in interfaceUserManager
- Throws:
UserManagerException
-
findUsersByQuery
public List<User> findUsersByQuery(UserQuery query) throws UserManagerException
Description copied from interface:UserManager
Find users matching properties, ordering and range as specified by theUserQuery
.- Specified by:
findUsersByQuery
in interfaceUserManager
- Parameters:
query
- the query.- Returns:
- a List of
User
objects. - Throws:
UserManagerException
-
findUsersByUsernameKey
public List<User> findUsersByUsernameKey(String usernameKey, boolean orderAscending) throws UserManagerException
- Specified by:
findUsersByUsernameKey
in interfaceUserManager
- Throws:
UserManagerException
- See Also:
UserManager.findUsersByUsernameKey(java.lang.String, boolean)
-
getId
public String getId()
Description copied from interface:UserManager
An Identifier for the UserManager.- Specified by:
getId
in interfaceUserManager
- Returns:
- the user manager identifier.
-
getUsers
public List<User> getUsers()
Description copied from interface:UserManager
Get the List ofUser
objects.- Specified by:
getUsers
in interfaceUserManager
- Returns:
- the List of
User
Objects. - See Also:
UserManager.getUsers()
-
getUsers
public List<User> getUsers(boolean orderAscending)
- Specified by:
getUsers
in interfaceUserManager
-
updateUser
public User updateUser(User user) throws UserNotFoundException, UserManagerException
Description copied from interface:UserManager
Update a User.- Specified by:
updateUser
in interfaceUserManager
- Parameters:
user
- the user to update.- Returns:
- the user that was just updated.
- Throws:
UserNotFoundException
- if the user was not found to update.UserManagerException
-
updateUser
public User updateUser(User user, boolean passwordChangeRequired) throws UserNotFoundException, UserManagerException
- Specified by:
updateUser
in interfaceUserManager
- Throws:
UserNotFoundException
UserManagerException
-
userExists
public boolean userExists(String principal) throws UserManagerException
Description copied from interface:UserManager
true if the user exists, false if it doesn't- Specified by:
userExists
in interfaceUserManager
- Returns:
- true, if user exists
- Throws:
UserManagerException
-
isFinalImplementation
public boolean isFinalImplementation()
- Specified by:
isFinalImplementation
in interfaceUserManager
- Overrides:
isFinalImplementation
in classAbstractUserManager
- Returns:
- true if this implementation is a final one and not a wrapper (configurable, cached)
-
getDescriptionKey
public String getDescriptionKey()
- Specified by:
getDescriptionKey
in interfaceUserManager
- Returns:
- a key to be able to customize label in UI
-
-