org.apache.lenya.ac.impl
Class AbstractUser

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.lenya.ac.impl.AbstractItem
          extended by org.apache.lenya.ac.impl.AbstractGroupable
              extended by org.apache.lenya.ac.impl.AbstractUser
All Implemented Interfaces:
java.lang.Comparable, org.apache.avalon.framework.logger.LogEnabled, org.apache.lenya.ac.Accreditable, org.apache.lenya.ac.Groupable, org.apache.lenya.ac.Identifiable, org.apache.lenya.ac.Item, org.apache.lenya.ac.User
Direct Known Subclasses:
FileUser

public abstract class AbstractUser
extends AbstractGroupable
implements org.apache.lenya.ac.User

Abstract user implementation.

Version:
$Id: AbstractUser.java 580116 2007-09-27 18:02:21Z rfrovarp $

Constructor Summary
AbstractUser(org.apache.lenya.ac.ItemManager itemManager, org.apache.avalon.framework.logger.Logger logger)
          Creates a new User.
AbstractUser(org.apache.lenya.ac.ItemManager itemManager, org.apache.avalon.framework.logger.Logger logger, java.lang.String id, java.lang.String fullName, java.lang.String _email, java.lang.String password)
          Create a User instance
 
Method Summary
 boolean authenticate(java.lang.String password)
          Authenticate a user.
 boolean canChangePassword()
          Checks support for changing password
 void delete()
          Delete a user
 java.lang.String getDefaultDocumentLocale()
           
 java.lang.String getDefaultMenuLocale()
           
 java.lang.String getEmail()
          Get the email address
protected  java.lang.String getEncryptedPassword()
          Get the encrypted password
abstract  void save()
          Save the user
 void setDefaultDocumentLocale(java.lang.String defaultDocumentLocale)
           
 void setDefaultMenuLocale(java.lang.String defaultMenuLocale)
           
 void setEmail(java.lang.String _email)
          Set the email address
protected  void setEncryptedPassword(java.lang.String _encryptedPassword)
          This method can be used for subclasses to set the password without it being encrypted again.
 void setPassword(java.lang.String plainTextPassword)
          Sets the password.
 
Methods inherited from class org.apache.lenya.ac.impl.AbstractGroupable
addedToGroup, getAccreditables, getGroups, removedFromGroup, removeFromAllGroups
 
Methods inherited from class org.apache.lenya.ac.impl.AbstractItem
compareTo, equals, getAccreditableManager, getDescription, getId, getItemManager, getName, hashCode, setDescription, setId, setName, toString
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.lenya.ac.User
getAccreditableManager
 
Methods inherited from interface org.apache.lenya.ac.Accreditable
getAccreditables
 
Methods inherited from interface org.apache.lenya.ac.Item
configure, getDescription, getId, getItemManager, getName, setDescription, setName
 
Methods inherited from interface org.apache.avalon.framework.logger.LogEnabled
enableLogging
 
Methods inherited from interface org.apache.lenya.ac.Groupable
addedToGroup, getGroups, removedFromGroup, removeFromAllGroups
 

Constructor Detail

AbstractUser

public AbstractUser(org.apache.lenya.ac.ItemManager itemManager,
                    org.apache.avalon.framework.logger.Logger logger)
Creates a new User.

Parameters:
itemManager - The item manager.
logger - The logger.

AbstractUser

public AbstractUser(org.apache.lenya.ac.ItemManager itemManager,
                    org.apache.avalon.framework.logger.Logger logger,
                    java.lang.String id,
                    java.lang.String fullName,
                    java.lang.String _email,
                    java.lang.String password)
Create a User instance

Parameters:
itemManager - The item manager.
logger - The logger.
id - the user id
fullName - the full name of the user
_email - the users email address
password - the users password
Method Detail

getEmail

public java.lang.String getEmail()
Get the email address

Specified by:
getEmail in interface org.apache.lenya.ac.User
Returns:
a String

setEmail

public void setEmail(java.lang.String _email)
Set the email address

Specified by:
setEmail in interface org.apache.lenya.ac.User
Parameters:
_email - the new email address

setPassword

public void setPassword(java.lang.String plainTextPassword)
Sets the password.

Specified by:
setPassword in interface org.apache.lenya.ac.User
Parameters:
plainTextPassword - The plain text passwrod.

setEncryptedPassword

protected void setEncryptedPassword(java.lang.String _encryptedPassword)
This method can be used for subclasses to set the password without it being encrypted again. Some subclass might have knowledge of the encrypted password and needs to be able to set it.

Parameters:
_encryptedPassword - the encrypted password

getEncryptedPassword

protected java.lang.String getEncryptedPassword()
Get the encrypted password

Returns:
the encrypted password

canChangePassword

public boolean canChangePassword()
Checks support for changing password

Specified by:
canChangePassword in interface org.apache.lenya.ac.User
Returns:
true if password change is supported

getDefaultDocumentLocale

public java.lang.String getDefaultDocumentLocale()
Specified by:
getDefaultDocumentLocale in interface org.apache.lenya.ac.User
Returns:
Returns the defaultDocumentLocale.

setDefaultDocumentLocale

public void setDefaultDocumentLocale(java.lang.String defaultDocumentLocale)
Specified by:
setDefaultDocumentLocale in interface org.apache.lenya.ac.User
Parameters:
defaultDocumentLocale - The defaultDocumentLocale to set.

getDefaultMenuLocale

public java.lang.String getDefaultMenuLocale()
Specified by:
getDefaultMenuLocale in interface org.apache.lenya.ac.User
Returns:
Returns the defaultMenuLocale.

setDefaultMenuLocale

public void setDefaultMenuLocale(java.lang.String defaultMenuLocale)
Specified by:
setDefaultMenuLocale in interface org.apache.lenya.ac.User
Parameters:
defaultMenuLocale - The defaultMenuLocale to set.

save

public abstract void save()
                   throws org.apache.lenya.ac.AccessControlException
Save the user

Specified by:
save in interface org.apache.lenya.ac.User
Throws:
org.apache.lenya.ac.AccessControlException - if the save failed

delete

public void delete()
            throws org.apache.lenya.ac.AccessControlException
Delete a user

Specified by:
delete in interface org.apache.lenya.ac.User
Throws:
org.apache.lenya.ac.AccessControlException - if the delete failed

authenticate

public boolean authenticate(java.lang.String password)
Authenticate a user. This is done by encrypting the given password and comparing this to the encryptedPassword.

Specified by:
authenticate in interface org.apache.lenya.ac.User
Parameters:
password - to authenticate with
Returns:
true if the given password matches the password for this user


Copyright © $ Apache Software Foundation. All Rights Reserved.