FileDocCategorySizeDatePackage
UserProfile.javaAPI DocAzureus 3.0.3.44986Tue Sep 06 06:46:52 BST 2005org.gudy.azureus2.ui.console

UserProfile

public class UserProfile extends 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
author
pauld

Fields Summary
private String
username
private String
userType
private String
encryptedPassword
private String
defaultSaveDirectory
public static final String
ADMIN
public static final String
USER
public static final String
GUEST
public static final String
DEFAULT_USER_TYPE
public static final UserProfile
DEFAULT_USER_PROFILE
Constructors Summary
public UserProfile()

		super();
		this.userType = DEFAULT_USER_TYPE;
	
public UserProfile(String name, String userType)

		this.username = name;
		this.userType = userType;
	
Methods Summary
public booleanauthenticate(java.lang.String password)
returns true if the specified password is the password for this user profile

param
password
return

		StringEncrypter encrypter;
		try {
			encrypter = new StringEncrypter(StringEncrypter.DES_ENCRYPTION_SCHEME);
			return encrypter.decrypt(encryptedPassword).equals(password);
		} catch (EncryptionException e) {
			throw new AzureusCoreException("Unable to decrypt password", e);
		}
	
public booleanequals(java.lang.Object obj)
check for equality with another user profile object

		if( obj == null || ! (obj instanceof UserProfile) )
			return false;
		UserProfile other = (UserProfile)obj;
		if( getUsername() != null )
			return getUsername().equals(other.getUsername());
		else
			if( other.getUsername() != null )
				return false;
		if( getEncryptedPassword() != null )
			return getEncryptedPassword().equals(other.getEncryptedPassword());
		else
			if( other.getEncryptedPassword() != null )
				return false;
			
		return true;
	
public java.lang.StringgetDefaultSaveDirectory()

return
the directory that torrents should be saved to for this user, by default

		return defaultSaveDirectory;
	
public java.lang.StringgetEncryptedPassword()

return
Returns the encryptedPassword.

		return encryptedPassword;
	
public java.lang.StringgetUserType()

return
Returns the userType.

		return userType;
	
public java.lang.StringgetUsername()

return
Returns the username.

		return username;
	
public static booleanisValidUserType(java.lang.String userType)
returns true if the specified value is a valid user type

param
userType
return

	
	              	 
	      
	
		return ADMIN.equals(userType) || USER.equals(userType) || GUEST.equals(userType);
	
public voidsetDefaultSaveDirectory(java.lang.String newValue)

		this.defaultSaveDirectory = newValue;
	
public voidsetEncryptedPassword(java.lang.String encryptedPassword)

param
encryptedPassword The encryptedPassword to set.

		this.encryptedPassword = encryptedPassword;
	
public voidsetPassword(java.lang.String password)
stores the specified password as an encrypted password

param
password The password to set.

		try {
			StringEncrypter encrypter = new StringEncrypter(StringEncrypter.DES_ENCRYPTION_SCHEME);
			setEncryptedPassword(encrypter.encrypt(password));
		} catch (EncryptionException e)
		{
			throw new AzureusCoreException("Unable to encrypt password", e);
		}
	
public voidsetUserType(java.lang.String userType)

param
userType The userType to set.

		this.userType = userType;
	
public voidsetUsername(java.lang.String username)

param
username The username to set.

		this.username = username;