Class User

java.lang.Object
com.articulate.sigma.User

public class User extends Object
A class that encrypts a string and checks it against another stored encrypted string, in order to validate a user login.
  • Field Details

    • username

      public String username
    • password

      public String password
      Encrypted password
    • role

      public String role
      A String which is one of: user, registered, administrator.
    • attributes

      public Map<String,String> attributes
      A HashMap of String keys and String values.
    • projects

      public List<String> projects
      A List of String keys consisting of unique project names.
  • Constructor Details

    • User

      public User()
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • createDB

      public static void createDB()
      Create a database with columns like this class
    • fromDB

      public static User fromDB(Connection conn, String username)
      Load the object from a relational DB
      Parameters:
      conn - the SQL connection
      username - the user name to search for
      Returns:
      the register user from the DB
    • toDB

      public void toDB(Connection conn)
      Save the object in the relational DB
      Parameters:
      conn - the SQL connection to interface with the DB
    • toggleRole

      public void toggleRole(Connection conn)
      Toggle user role between 'guest' and 'user'
      Parameters:
      conn - the SQL connection to interface with the DB
    • updateRole

      public void updateRole(Connection conn)
      Update the role for this user
    • updatePassword

      public void updatePassword(Connection conn)
      Update just the password for this user
    • getRole

      public String getRole()
      Returns:
      the role of this user
    • main

      public static void main(String[] args)