java.lang.Object
com.aoindustries.aoserv.client.AoservObject<User.Name,User>
com.aoindustries.aoserv.client.CachedObject<User.Name,User>
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
A
MysqlUser
stores the details of a MySQL account
that are common to all servers.- Author:
- AO Industries, Inc.
- See Also:
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Deprecated.static final User.Name
The username of the MySQLmysql.session
user added in MySQL 5.7.static final User.Name
The username of the MySQLmysql.sys
user added in MySQL 5.7.static final User.Name
The default username for MySQL monitoring.static final String
A password may be set to null, which means that the account will be disabled.static final String
static final User.Name
The username of the MySQL super user.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
-
Method Summary
Modifier and TypeMethodDescriptionint
addMysqlServerUser
(Server mysqlServer, String host) int
boolean
canAlter()
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
canDrop()
boolean
boolean
canEvent()
boolean
boolean
canFile()
boolean
canGrant()
boolean
canIndex()
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
static List
<PasswordChecker.Result> checkPassword
(User.Name username, String password) checkPassword
(String password) void
disable
(DisableLog dl) void
enable()
Lists the reasons an object may not be removed.protected Object
getColumnImpl
(int i) getMysqlServerUser
(Server mysqlServer) void
Initializes this object from the raw database contents.boolean
Checks if this object is disabled.boolean
boolean
boolean
static boolean
Special MySQL users may not be added or removed.boolean
isSuper()
void
read
(StreamableInput in, AoservProtocol.Version protocolVersion) void
remove()
Removes this object, and all dependant objects, from the system.void
setPassword
(String password) void
write
(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 Details
-
MAX_USERNAME_LENGTH
Deprecated.Please useUser.Name.MAX_LENGTH
instead.The maximum length of a MySQL username.- See Also:
-
ROOT
The username of the MySQL super user. -
MYSQL_SESSION
The username of the MySQLmysql.session
user added in MySQL 5.7. -
MYSQL_SYS
The username of the MySQLmysql.sys
user added in MySQL 5.7. -
MYSQLMON
The default username for MySQL monitoring. -
NO_PASSWORD
A password may be set to null, which means that the account will be disabled. -
NO_PASSWORD_DB_VALUE
- See Also:
-
-
Constructor Details
-
User
Deprecated.Only required for implementation, do not use directly.- See Also:
-
-
Method Details
-
isSpecial
Special MySQL users may not be added or removed. -
addMysqlServerUser
- Throws:
IOException
SQLException
-
arePasswordsSet
- Specified by:
arePasswordsSet
in interfacePasswordProtected
- Throws:
IOException
SQLException
-
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
- Specified by:
canDisable
in interfaceDisablable
- Throws:
IOException
SQLException
-
canDrop
public boolean canDrop() -
canEnable
- Specified by:
canEnable
in interfaceDisablable
- Throws:
SQLException
IOException
-
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
- Specified by:
checkPassword
in interfacePasswordProtected
- Throws:
IOException
-
checkPassword
public static List<PasswordChecker.Result> checkPassword(User.Name username, String password) throws IOException - Throws:
IOException
-
disable
- Specified by:
disable
in interfaceDisablable
- Throws:
IOException
SQLException
-
enable
- Specified by:
enable
in interfaceDisablable
- Throws:
IOException
SQLException
-
getColumnImpl
- Specified by:
getColumnImpl
in classAoservObject<User.Name,
User>
-
isDisabled
public boolean isDisabled()Description copied from interface:Disablable
Checks 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:
isDisabled
in interfaceDisablable
-
getDisableLog_id
-
getDisableLog
- Specified by:
getDisableLog
in interfaceDisablable
- Throws:
SQLException
IOException
-
getMysqlServerUser
- Throws:
IOException
SQLException
-
getMysqlServerUsers
- Throws:
IOException
SQLException
-
getTableId
- Specified by:
getTableId
in classAoservObject<User.Name,
User>
-
getUsername_id
-
getUsername
- Throws:
SQLException
IOException
-
isSpecial
public boolean isSpecial() -
init
Description copied from class:AoservObject
Initializes this object from the raw database contents.- Specified by:
init
in classAoservObject<User.Name,
User> - Parameters:
result
- theResultSet
containing the row to copy into this object- Throws:
SQLException
-
read
- Specified by:
read
in interfaceAoservReadable
- Specified by:
read
in interfaceAoservStreamable
- Specified by:
read
in classAoservObject<User.Name,
User> - Throws:
IOException
-
getCannotRemoveReasons
Description copied from interface:Removable
Lists the reasons an object may not be removed.- Specified by:
getCannotRemoveReasons
in interfaceRemovable
- Returns:
- an empty
List<CannotRemoveReason>
if this object may be removed, or a list of descriptions
-
remove
Description copied from interface:Removable
Removes this object, and all dependant objects, from the system.- Specified by:
remove
in interfaceRemovable
- Throws:
IOException
SQLException
-
setPassword
- Specified by:
setPassword
in interfacePasswordProtected
- Throws:
IOException
SQLException
-
write
- Specified by:
write
in interfaceAoservStreamable
- Specified by:
write
in interfaceAoservWritable
- Specified by:
write
in classAoservObject<User.Name,
User> - Throws:
IOException
-
canSetPassword
public boolean canSetPassword()- Specified by:
canSetPassword
in interfacePasswordProtected
-
User.Name.MAX_LENGTH
instead.