public class DbUserManager extends AbstractUserManager
ATTR_ENABLE, ATTR_HOME, ATTR_LOGIN, ATTR_MAX_DOWNLOAD_RATE, ATTR_MAX_IDLE_TIME, ATTR_MAX_LOGIN_NUMBER, ATTR_MAX_LOGIN_PER_IP, ATTR_MAX_UPLOAD_RATE, ATTR_PASSWORD, ATTR_WRITE_PERM
Constructor and Description |
---|
DbUserManager(DataSource dataSource,
String selectAllStmt,
String selectUserStmt,
String insertUserStmt,
String updateUserStmt,
String deleteUserStmt,
String authenticateStmt,
String isAdminStmt,
PasswordEncryptor passwordEncryptor,
String adminName)
Internal constructor, do not use directly.
|
Modifier and Type | Method and Description |
---|---|
User |
authenticate(Authentication authentication)
User authentication.
|
protected void |
closeQuitely(Connection con) |
protected Connection |
createConnection()
Open connection to database.
|
void |
delete(String name)
Delete user.
|
boolean |
doesExist(String name)
User existance check.
|
String[] |
getAllUserNames()
Get all user names from the database.
|
DataSource |
getDataSource()
Retrive the data source used by the user manager
|
String |
getSqlUserAdmin()
Get the SQL SELECT statement used to find whether an user is admin or
not.
|
String |
getSqlUserAuthenticate()
Get the SQL SELECT statement used to authenticate user.
|
String |
getSqlUserDelete()
Get the SQL DELETE statement used to delete an existing user.
|
String |
getSqlUserInsert()
Get the SQL INSERT statement used to add a new user.
|
String |
getSqlUserSelect()
Get the SQL SELECT statement used to select an existing user.
|
String |
getSqlUserSelectAll()
Get the SQL SELECT statement used to select all user ids.
|
String |
getSqlUserUpdate()
Get the SQL UPDATE statement used to update an existing user.
|
User |
getUserByName(String name)
Get the user object.
|
boolean |
isAdmin(String login)
Check if the user is admin.
|
void |
save(User user)
Save user.
|
void |
setDataSource(DataSource dataSource)
Set the data source to be used by the user manager
|
void |
setSqlUserAdmin(String sql)
Set the SQL SELECT statement used to find whether an user is admin or
not.
|
void |
setSqlUserAuthenticate(String sql)
Set the SQL SELECT statement used to authenticate user.
|
void |
setSqlUserDelete(String sql)
Set the SQL DELETE statement used to delete an existing user.
|
void |
setSqlUserInsert(String sql)
Set the SQL INSERT statement used to add a new user.
|
void |
setSqlUserSelect(String sql)
Set the SQL SELECT statement used to select an existing user.
|
void |
setSqlUserSelectAll(String sql)
Set the SQL SELECT statement used to select all user ids.
|
void |
setSqlUserUpdate(String sql)
Set the SQL UPDATE statement used to update an existing user.
|
getAdminName, getPasswordEncryptor
public DbUserManager(DataSource dataSource, String selectAllStmt, String selectUserStmt, String insertUserStmt, String updateUserStmt, String deleteUserStmt, String authenticateStmt, String isAdminStmt, PasswordEncryptor passwordEncryptor, String adminName)
DbUserManagerFactory
instead.public DataSource getDataSource()
public void setDataSource(DataSource dataSource)
dataSource
- The data source to usepublic String getSqlUserInsert()
public void setSqlUserInsert(String sql)
sql
- The SQL statementpublic String getSqlUserDelete()
public void setSqlUserDelete(String sql)
sql
- The SQL statementpublic String getSqlUserUpdate()
public void setSqlUserUpdate(String sql)
sql
- The SQL statementpublic String getSqlUserSelect()
public void setSqlUserSelect(String sql)
sql
- The SQL statementpublic String getSqlUserSelectAll()
public void setSqlUserSelectAll(String sql)
sql
- The SQL statementpublic String getSqlUserAuthenticate()
public void setSqlUserAuthenticate(String sql)
sql
- The SQL statementpublic String getSqlUserAdmin()
public void setSqlUserAdmin(String sql)
sql
- The SQL statementpublic boolean isAdmin(String login) throws FtpException
UserManager
isAdmin
in interface UserManager
isAdmin
in class AbstractUserManager
login
- The name of the User
to checkFtpException
- when the UserManager can't fulfill the request.protected Connection createConnection() throws SQLException
SQLException
public void delete(String name) throws FtpException
name
- The name of the User
to deleteFtpException
- when the UserManager can't fulfill the request.public void save(User user) throws FtpException
user
- the Uset to saveFtpException
- when the UserManager can't fulfill the request.protected void closeQuitely(Connection con)
public User getUserByName(String name) throws FtpException
name
- the name to search for.FtpException
- when the UserManager can't fulfill the request.public boolean doesExist(String name) throws FtpException
name
- the name of the user to check.FtpException
public String[] getAllUserNames() throws FtpException
FtpException
- when the UserManager can't fulfill the request.public User authenticate(Authentication authentication) throws AuthenticationFailedException
authentication
- The Authentication
that proves the users identityAuthenticationFailedException
Copyright © 2003–2016 The Apache Software Foundation. All rights reserved.