@ThreadRestricted(value="touch") public final class UserSettings extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
UserSettings.Table
The user-settings table of a vote-server, storing the settings in relational form.
|
Constructor and Description |
---|
UserSettings(String voterEmail,
UserSettings.Table table)
Constructs a UserSettings, reading its initial state from the user table.
|
Modifier and Type | Method and Description |
---|---|
void |
clearOpenID()
Clears the OpenID by setting it to null.
|
static UserSettings |
forOpenID(String openID,
UserSettings.Table table)
Retrieves a user's settings from the table, doing the lookup by OpenID.
|
String |
getLoginPersistKey()
The secure hash of the user's persisted login.
|
String |
getOpenID()
An authenticated OpenID identifier for the user.
|
void |
setLoginPersistKey(String newLoginPersistKey)
Sets the secure hash of the user's persisted login.
|
void |
setOpenID(Identifier verifiedID)
Changes the OpenID, setting it to an authenticated value.
|
String |
voterEmail()
Identifies the user for voting purposes.
|
void |
write(UserSettings.Table table,
ServiceSession userSession)
Writes these user settings to the table if they have unwritten changes, or deletes
them if they are at default.
|
void |
write(UserSettings.Table table,
ServiceSession userSession,
boolean toForce)
Writes these user settings to the table, or deletes them if they are all at
default.
|
public UserSettings(String voterEmail, UserSettings.Table table) throws SQLException
SQLException
voterEmail()
public static UserSettings forOpenID(String openID, UserSettings.Table table) throws SQLException
SQLException
getOpenID()
public String getLoginPersistKey()
setLoginPersistKey(String)
,
OpenIDAuthenticator.newPersistKey(String,String)
public void setLoginPersistKey(String newLoginPersistKey)
getLoginPersistKey()
public String getOpenID()
clearOpenID()
,
setOpenID(Identifier)
public void clearOpenID()
getOpenID()
public void setOpenID(Identifier verifiedID)
verifiedID
- the verified
identifier from the positive authentication result.getOpenID()
public String voterEmail()
InternetAddressX.canonicalAddress(String)
public void write(UserSettings.Table table, ServiceSession userSession) throws SQLException, VoterInputTable.BadInputException
public void write(UserSettings.Table table, ServiceSession userSession, boolean toForce) throws SQLException, VoterInputTable.BadInputException
toForce
- false to write only if changes were made; true to force the
write regardless.SQLException
VoterInputTable.BadInputException