Class UserProfile


  • public class UserProfile
    extends java.lang.Object
    the user profile contains the information about a user that is allowed to use the console ui. Users may be assigned one of three profiles:
    • ADMIN have full access to all commands and to torrents of all users
    • USER have limited access to commands - can only add/modify their own torrents
    • GUEST have no access - can only view the torrent download status
    • Field Detail

      • username

        private java.lang.String username
      • userType

        private java.lang.String userType
      • encryptedPassword

        private java.lang.String encryptedPassword
      • defaultSaveDirectory

        private java.lang.String defaultSaveDirectory
      • DEFAULT_USER_TYPE

        public static final java.lang.String DEFAULT_USER_TYPE
        See Also:
        Constant Field Values
      • DEFAULT_USER_PROFILE

        public static final UserProfile DEFAULT_USER_PROFILE
    • Constructor Detail

      • UserProfile

        public UserProfile()
      • UserProfile

        public UserProfile​(java.lang.String name,
                           java.lang.String userType)
    • Method Detail

      • isValidUserType

        public static boolean isValidUserType​(java.lang.String userType)
        returns true if the specified value is a valid user type
        Parameters:
        userType -
        Returns:
      • authenticate

        public boolean authenticate​(java.lang.String password)
        returns true if the specified password is the password for this user profile
        Parameters:
        password -
        Returns:
      • setPassword

        public void setPassword​(java.lang.String password)
        stores the specified password as an encrypted password
        Parameters:
        password - The password to set.
      • getUsername

        public java.lang.String getUsername()
        Returns:
        Returns the username.
      • setUsername

        public void setUsername​(java.lang.String username)
        Parameters:
        username - The username to set.
      • getUserType

        public java.lang.String getUserType()
        Returns:
        Returns the userType.
      • setUserType

        public void setUserType​(java.lang.String userType)
        Parameters:
        userType - The userType to set.
      • equals

        public boolean equals​(java.lang.Object obj)
        check for equality with another user profile object
        Overrides:
        equals in class java.lang.Object
      • getEncryptedPassword

        public java.lang.String getEncryptedPassword()
        Returns:
        Returns the encryptedPassword.
      • setEncryptedPassword

        public void setEncryptedPassword​(java.lang.String encryptedPassword)
        Parameters:
        encryptedPassword - The encryptedPassword to set.
      • getDefaultSaveDirectory

        public java.lang.String getDefaultSaveDirectory()
        Returns:
        the directory that torrents should be saved to for this user, by default
      • setDefaultSaveDirectory

        public void setDefaultSaveDirectory​(java.lang.String newValue)