Package com.articulate.sigma
Class User
java.lang.Object
com.articulate.sigma.User
A class that encrypts a string and checks it against another stored
encrypted string, in order to validate a user login.
-
Field Summary
FieldsModifier and TypeFieldDescriptionA HashMap of String keys and String values.Encrypted passwordA List of String keys consisting of unique project names.A String which is one of: user, registered, administrator. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcreateDB()Create a database with columns like this classstatic UserfromDB(Connection conn, String username) Load the object from a relational DBgetRole()static voidvoidtoDB(Connection conn) Save the object in the relational DBvoidtoggleRole(Connection conn) Toggle user role between 'guest' and 'user'toString()voidupdatePassword(Connection conn) Update just the password for this uservoidupdateRole(Connection conn) Update the role for this user
-
Field Details
-
username
-
password
Encrypted password -
role
A String which is one of: user, registered, administrator. -
attributes
A HashMap of String keys and String values. -
projects
A List of String keys consisting of unique project names.
-
-
Constructor Details
-
User
public User()
-
-
Method Details
-
toString
-
createDB
public static void createDB()Create a database with columns like this class -
fromDB
Load the object from a relational DB- Parameters:
conn- the SQL connectionusername- the user name to search for- Returns:
- the register user from the DB
-
toDB
Save the object in the relational DB- Parameters:
conn- the SQL connection to interface with the DB
-
toggleRole
Toggle user role between 'guest' and 'user'- Parameters:
conn- the SQL connection to interface with the DB
-
updateRole
Update the role for this user -
updatePassword
Update just the password for this user -
getRole
- Returns:
- the role of this user
-
main
-