- java.lang.Object
-
- com.aoindustries.aoserv.client.AOServObject<K,T>
-
- com.aoindustries.aoserv.client.CachedObject<User.Name,V>
-
- com.aoindustries.aoserv.client.mysql.CachedObjectUserNameKey<User>
-
- com.aoindustries.aoserv.client.mysql.User
-
- All Implemented Interfaces:
Streamable,StreamReadable,StreamWritable,Row,AOServReadable,AOServStreamable,AOServWritable,Disablable,PasswordProtected,Removable,SingleTableObject<User.Name,User>
public final class User extends CachedObjectUserNameKey<User> implements PasswordProtected, Removable, Disablable
AMySQLUserstores the details of a MySQL account that are common to all servers.- Author:
- AO Industries, Inc.
- See Also:
UserServer,DatabaseUser
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classUser.NameRepresents a MySQL user ID.
-
Field Summary
Fields Modifier and Type Field Description static intMAX_USERNAME_LENGTHDeprecated.Please useUser.Name.MAX_LENGTHinstead.static User.NameMYSQL_SESSIONThe username of the MySQL special users.static User.NameMYSQL_SYSThe username of the MySQL special users.static User.NameMYSQLMONThe username of the MySQL special users.static StringNO_PASSWORDA password may be set to null, which means that the account will be disabled.static StringNO_PASSWORD_DB_VALUEstatic User.NameROOTThe username of the MySQL special users.-
Fields inherited from class com.aoindustries.aoserv.client.mysql.CachedObjectUserNameKey
pkey
-
Fields inherited from class com.aoindustries.aoserv.client.CachedObject
table
-
Fields inherited from class com.aoindustries.aoserv.client.AOServObject
USE_ARRAY_OF_DOMAIN, USE_SQL_DATA, USE_SQL_DATA_WRITE
-
Fields inherited from interface com.aoindustries.aoserv.client.password.PasswordProtected
ALL, NONE, SOME
-
-
Constructor Summary
Constructors Constructor Description User()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intaddMySQLServerUser(Server mysqlServer, String host)intarePasswordsSet()booleancanAlter()booleancanAlterRoutine()booleancanCreate()booleancanCreateRoutine()booleancanCreateTempTable()booleancanCreateUser()booleancanCreateView()booleancanDelete()booleancanDisable()booleancanDrop()booleancanEnable()booleancanEvent()booleancanExecute()booleancanFile()booleancanGrant()booleancanIndex()booleancanInsert()booleancanLockTables()booleancanProcess()booleancanReference()booleancanReload()booleancanSelect()booleancanSetPassword()booleancanShowDB()booleancanShowView()booleancanShutdown()booleancanTrigger()booleancanUpdate()static List<PasswordChecker.Result>checkPassword(User.Name username, String password)List<PasswordChecker.Result>checkPassword(String password)voiddisable(DisableLog dl)voidenable()List<CannotRemoveReason<User>>getCannotRemoveReasons()Lists the reasons an object may not be removed.protected ObjectgetColumnImpl(int i)DisableLoggetDisableLog()IntegergetDisableLog_id()UserServergetMySQLServerUser(Server mysqlServer)List<UserServer>getMySQLServerUsers()Table.TableIDgetTableID()UsergetUsername()User.NamegetUsername_id()voidinit(ResultSet result)Initializes this object from the raw database contents.booleanisDisabled()Checks if this object is disabled.booleanisReplicationClient()booleanisReplicationSlave()booleanisSpecial()static booleanisSpecial(User.Name username)Special MySQL users may not be added or removed.booleanisSuper()voidread(StreamableInput in, AoservProtocol.Version protocolVersion)voidremove()Removes this object, and all dependant objects, from the system.voidsetPassword(String password)voidwrite(StreamableOutput out, AoservProtocol.Version protocolVersion)-
Methods inherited from class com.aoindustries.aoserv.client.mysql.CachedObjectUserNameKey
equals, getKey, hashCode, toStringImpl
-
Methods inherited from class com.aoindustries.aoserv.client.CachedObject
getTable, setTable
-
Methods inherited from class com.aoindustries.aoserv.client.AOServObject
compare, compare, compare, compare, compareIgnoreCaseConsistentWithEquals, compareTo, compareTo, compareTo, getAccountingCode, getColumn, getColumns, getColumns, getDomainLabel, getDomainLabels, getDomainName, getDto, getEmail, getGecos, getGroupId, getHashedKey, getHashedPassword, getHostname, getInetAddress, getLinuxID, getLinuxUserName, getMacAddress, getMySQLDatabaseName, getMySQLServerName, getMysqlUserName, getPort, getPostgresDatabaseName, getPostgresServerName, getPostgresUserId, getTableSchema, getTimeMillis, getTimeMillis, getUnixPath, getUserId, read, toString, write
-
-
-
-
Field Detail
-
MAX_USERNAME_LENGTH
@Deprecated public static final int MAX_USERNAME_LENGTH
Deprecated.Please useUser.Name.MAX_LENGTHinstead.The maximum length of a MySQL username.- See Also:
- Constant Field Values
-
ROOT
public static final User.Name ROOT
The username of the MySQL special users.
-
MYSQL_SESSION
public static final User.Name MYSQL_SESSION
The username of the MySQL special users.
-
MYSQL_SYS
public static final User.Name MYSQL_SYS
The username of the MySQL special users.
-
MYSQLMON
public static final User.Name MYSQLMON
The username of the MySQL special users.
-
NO_PASSWORD
public static final String NO_PASSWORD
A password may be set to null, which means that the account will be disabled.
-
NO_PASSWORD_DB_VALUE
public static final String NO_PASSWORD_DB_VALUE
- See Also:
- Constant Field Values
-
-
Method Detail
-
isSpecial
public static boolean isSpecial(User.Name username)
Special MySQL users may not be added or removed.
-
addMySQLServerUser
public int addMySQLServerUser(Server mysqlServer, String host) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
arePasswordsSet
public int arePasswordsSet() throws IOException, SQLException- Specified by:
arePasswordsSetin interfacePasswordProtected- Throws:
IOExceptionSQLException
-
canAlter
public boolean canAlter()
-
canShowDB
public boolean canShowDB()
-
isSuper
public boolean isSuper()
-
canCreateTempTable
public boolean canCreateTempTable()
-
canLockTables
public boolean canLockTables()
-
canExecute
public boolean canExecute()
-
isReplicationSlave
public boolean isReplicationSlave()
-
isReplicationClient
public boolean isReplicationClient()
-
canCreateView
public boolean canCreateView()
-
canShowView
public boolean canShowView()
-
canCreateRoutine
public boolean canCreateRoutine()
-
canAlterRoutine
public boolean canAlterRoutine()
-
canCreateUser
public boolean canCreateUser()
-
canEvent
public boolean canEvent()
-
canTrigger
public boolean canTrigger()
-
canCreate
public boolean canCreate()
-
canDelete
public boolean canDelete()
-
canDisable
public boolean canDisable() throws IOException, SQLException- Specified by:
canDisablein interfaceDisablable- Throws:
IOExceptionSQLException
-
canDrop
public boolean canDrop()
-
canEnable
public boolean canEnable() throws SQLException, IOException- Specified by:
canEnablein interfaceDisablable- Throws:
SQLExceptionIOException
-
canFile
public boolean canFile()
-
canGrant
public boolean canGrant()
-
canIndex
public boolean canIndex()
-
canInsert
public boolean canInsert()
-
canProcess
public boolean canProcess()
-
canReference
public boolean canReference()
-
canReload
public boolean canReload()
-
canSelect
public boolean canSelect()
-
canShutdown
public boolean canShutdown()
-
canUpdate
public boolean canUpdate()
-
checkPassword
public List<PasswordChecker.Result> checkPassword(String password) throws IOException
- Specified by:
checkPasswordin interfacePasswordProtected- Throws:
IOException
-
checkPassword
public static List<PasswordChecker.Result> checkPassword(User.Name username, String password) throws IOException
- Throws:
IOException
-
disable
public void disable(DisableLog dl) throws IOException, SQLException
- Specified by:
disablein interfaceDisablable- Throws:
IOExceptionSQLException
-
enable
public void enable() throws IOException, SQLException- Specified by:
enablein interfaceDisablable- Throws:
IOExceptionSQLException
-
getColumnImpl
protected Object getColumnImpl(int i)
- Specified by:
getColumnImplin classAOServObject<User.Name,User>
-
isDisabled
public boolean isDisabled()
Description copied from interface:DisablableChecks if this object is disabled. This should execute very quickly (not incur any round-trip to any database) and thus does not throw any checked exceptions.- Specified by:
isDisabledin interfaceDisablable
-
getDisableLog_id
public Integer getDisableLog_id()
-
getDisableLog
public DisableLog getDisableLog() throws SQLException, IOException
- Specified by:
getDisableLogin interfaceDisablable- Throws:
SQLExceptionIOException
-
getMySQLServerUser
public UserServer getMySQLServerUser(Server mysqlServer) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getMySQLServerUsers
public List<UserServer> getMySQLServerUsers() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getTableID
public Table.TableID getTableID()
- Specified by:
getTableIDin classAOServObject<User.Name,User>
-
getUsername_id
public User.Name getUsername_id()
-
getUsername
public User getUsername() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
isSpecial
public boolean isSpecial()
-
init
public void init(ResultSet result) throws SQLException
Description copied from class:AOServObjectInitializes this object from the raw database contents.- Specified by:
initin classAOServObject<User.Name,User>- Parameters:
result- theResultSetcontaining the row to copy into this object- Throws:
SQLException
-
read
public void read(StreamableInput in, AoservProtocol.Version protocolVersion) throws IOException
- Specified by:
readin interfaceAOServReadable- Specified by:
readin interfaceAOServStreamable- Specified by:
readin classAOServObject<User.Name,User>- Throws:
IOException
-
getCannotRemoveReasons
public List<CannotRemoveReason<User>> getCannotRemoveReasons()
Description copied from interface:RemovableLists the reasons an object may not be removed.- Specified by:
getCannotRemoveReasonsin interfaceRemovable- Returns:
- an empty
List<CannotRemoveReason>if this object may be removed, or a list of descriptions
-
remove
public void remove() throws IOException, SQLExceptionDescription copied from interface:RemovableRemoves this object, and all dependant objects, from the system.- Specified by:
removein interfaceRemovable- Throws:
IOExceptionSQLException
-
setPassword
public void setPassword(String password) throws IOException, SQLException
- Specified by:
setPasswordin interfacePasswordProtected- Throws:
IOExceptionSQLException
-
write
public void write(StreamableOutput out, AoservProtocol.Version protocolVersion) throws IOException
- Specified by:
writein interfaceAOServStreamable- Specified by:
writein interfaceAOServWritable- Specified by:
writein classAOServObject<User.Name,User>- Throws:
IOException
-
canSetPassword
public boolean canSetPassword()
- Specified by:
canSetPasswordin interfacePasswordProtected
-
-