1 package org.openslx.imagemaster.db.mappers;
3 import java.sql.ResultSet;
4 import java.sql.SQLException;
5 import java.util.ArrayList;
8 import org.apache.logging.log4j.LogManager;
9 import org.apache.logging.log4j.Logger;
11 import org.
openslx.bwlp.thrift.iface.TNotFoundException;
25 private static final Logger
LOGGER = LogManager.getLogger(
DbUser.class );
28 +
" user.userid, user.password, user.organizationid, user.firstname, user.lastname, user.email"
33 return new LocalUser( rs.getString(
"userid" ), rs.getString(
"password" ),
34 rs.getString(
"organizationid" ), rs.getString(
"firstname" ), rs.getString(
"lastname" ), rs.getString(
"email" ),
50 +
" WHERE user.userid = :userid" );
56 }
catch ( SQLException e ) {
57 LOGGER.error(
"Query failed in DbUser.forLogin()", e );
70 public static UserInfo
getUserInfo(
final String login )
throws SQLException, TNotFoundException
74 throw new TNotFoundException();
81 +
" WHERE user.userid = :userid" );
89 public static List<UserInfo>
findUser( String organizationId, String searchTerm )
92 return new ArrayList<>( 0 );
95 public static boolean exists( UserInfo user )
97 return exists( user,
false );
100 public static boolean exists( UserInfo user,
boolean withIdentity )
104 return exists( user.userId, withIdentity );
107 private static boolean exists( String userId,
boolean withIdentitiy )
109 if ( userId == null )
113 }
catch ( SQLException e ) {
static UserInfo getUserInfoOrNull(MysqlConnection connection, String userId)
static List< UserInfo > findUser(String organizationId, String searchTerm)
static boolean exists(UserInfo user, boolean withIdentity)
static MysqlConnection getConnection()
Get a connection to the database.
ResultSet executeQuery()
Executes the statement, which must be a query.
Represents a user that can login against the masterserver.
static final boolean verifyPassword(String plaintextPass, String sha512CryptText)
static boolean exists(UserInfo user)
static LocalUser forUserId(String login, String password)
static UserInfo getUserInfo(final String login)
void setString(String name, String value)
Sets a parameter.
static LocalUser forUserId(final String login)
Query database for user with given user id.
Class for creating PreparedStatements with named parameters.
static boolean exists(String userId, boolean withIdentitiy)
static LocalUser localFromRs(ResultSet rs)
static final Logger LOGGER
static final String localUserSql