- java.lang.Object
-
- com.aoindustries.aoserv.client.AOServObject<K,T>
-
- com.aoindustries.aoserv.client.CachedObject<User.Name,V>
-
- com.aoindustries.aoserv.client.postgresql.CachedObjectUserNameKey<User>
-
- com.aoindustries.aoserv.client.postgresql.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 Removable, PasswordProtected, Disablable
APostgresUsermay have access to multiple servers. The information common to all servers is contained inPostgresUser.- Author:
- AO Industries, Inc.
- See Also:
UserServer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classUser.NameRepresents a PostgreSQL user ID.
-
Field Summary
Fields Modifier and Type Field Description static User.NameAOADMINThe username of the PostgreSQL special users.static User.NameAOSERV_APPThe username of the PostgreSQL special users.static User.NameAOWEB_APPThe username of the PostgreSQL special users.static intMAX_USERNAME_LENGTHDeprecated.Please useUser.Name.MAX_LENGTHinstead.static StringNO_PASSWORDA password may be set to null, which means that the account will be disabled.static StringNO_PASSWORD_DB_VALUEstatic User.NamePG_EXECUTE_SERVER_PROGRAMThe username of the PostgreSQL special users.static User.NamePG_MONITORThe username of the PostgreSQL special users.static User.NamePG_READ_ALL_SETTINGSThe username of the PostgreSQL special users.static User.NamePG_READ_ALL_STATSThe username of the PostgreSQL special users.static User.NamePG_READ_SERVER_FILESThe username of the PostgreSQL special users.static User.NamePG_SIGNAL_BACKENDThe username of the PostgreSQL special users.static User.NamePG_STAT_SCAN_TABLESThe username of the PostgreSQL special users.static User.NamePG_WRITE_SERVER_FILESThe username of the PostgreSQL special users.static User.NamePOSTGRESThe username of the PostgreSQL special users.static User.NamePOSTGRESMONThe username of the PostgreSQL special users.-
Fields inherited from class com.aoindustries.aoserv.client.postgresql.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 intaddPostgresServerUser(Server postgresServer)intarePasswordsSet()booleancanCatUPD()booleancanCreateDB()booleancanDisable()booleancanEnable()booleancanSetPassword()booleancanTrace()static List<PasswordChecker.Result>checkPassword(User.Name username, String password)List<PasswordChecker.Result>checkPassword(String password)voiddisable(DisableLog dl)voidenable()List<CannotRemoveReason<?>>getCannotRemoveReasons()Lists the reasons an object may not be removed.protected ObjectgetColumnImpl(int i)DisableLoggetDisableLog()IntegergetDisableLog_id()UserServergetPostgresServerUser(Server server)List<UserServer>getPostgresServerUsers()Table.TableIDgetTableID()UsergetUsername()User.NamegetUsername_username_id()voidinit(ResultSet result)Initializes this object from the raw database contents.booleanisDatabaseAdmin()booleanisDisabled()Checks if this object is disabled.booleanisSpecial()static booleanisSpecial(User.Name username)Special PostgreSQL users may not be added or removed.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.postgresql.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 PostgreSQL username.- See Also:
- Constant Field Values
-
POSTGRES
public static final User.Name POSTGRES
The username of the PostgreSQL special users.
-
PG_MONITOR
public static final User.Name PG_MONITOR
The username of the PostgreSQL special users.
-
PG_READ_ALL_SETTINGS
public static final User.Name PG_READ_ALL_SETTINGS
The username of the PostgreSQL special users.
-
PG_READ_ALL_STATS
public static final User.Name PG_READ_ALL_STATS
The username of the PostgreSQL special users.
-
PG_SIGNAL_BACKEND
public static final User.Name PG_SIGNAL_BACKEND
The username of the PostgreSQL special users.
-
PG_STAT_SCAN_TABLES
public static final User.Name PG_STAT_SCAN_TABLES
The username of the PostgreSQL special users.
-
PG_EXECUTE_SERVER_PROGRAM
public static final User.Name PG_EXECUTE_SERVER_PROGRAM
The username of the PostgreSQL special users.
-
PG_READ_SERVER_FILES
public static final User.Name PG_READ_SERVER_FILES
The username of the PostgreSQL special users.
-
PG_WRITE_SERVER_FILES
public static final User.Name PG_WRITE_SERVER_FILES
The username of the PostgreSQL special users.
-
POSTGRESMON
public static final User.Name POSTGRESMON
The username of the PostgreSQL special users.
-
AOADMIN
public static final User.Name AOADMIN
The username of the PostgreSQL special users.
-
AOSERV_APP
public static final User.Name AOSERV_APP
The username of the PostgreSQL special users.
-
AOWEB_APP
public static final User.Name AOWEB_APP
The username of the PostgreSQL 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 PostgreSQL users may not be added or removed.
-
addPostgresServerUser
public int addPostgresServerUser(Server postgresServer) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
arePasswordsSet
public int arePasswordsSet() throws IOException, SQLException- Specified by:
arePasswordsSetin interfacePasswordProtected- Throws:
IOExceptionSQLException
-
canCatUPD
public boolean canCatUPD()
-
canCreateDB
public boolean canCreateDB()
-
canDisable
public boolean canDisable() throws IOException, SQLException- Specified by:
canDisablein interfaceDisablable- Throws:
IOExceptionSQLException
-
canEnable
public boolean canEnable() throws SQLException, IOException- Specified by:
canEnablein interfaceDisablable- Throws:
SQLExceptionIOException
-
canTrace
public boolean canTrace()
-
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
-
getPostgresServerUser
public UserServer getPostgresServerUser(Server server) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getPostgresServerUsers
public List<UserServer> getPostgresServerUsers() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getTableID
public Table.TableID getTableID()
- Specified by:
getTableIDin classAOServObject<User.Name,User>
-
getUsername_username_id
public User.Name getUsername_username_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
-
isDatabaseAdmin
public boolean isDatabaseAdmin()
-
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<?>> getCannotRemoveReasons() throws SQLException, IOException
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 - Throws:
SQLExceptionIOException
-
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
-
-