FileDocCategorySizeDatePackage
User.javaAPI DocExample3438Mon Mar 31 23:09:44 BST 2003org.dasein.security

User

public class User extends Object implements Serializable

Fields Summary
public static final String
USER_ID
private Locale
locale
private String
userID
Constructors Summary
public User()

    
      
        super();
    
Methods Summary
public synchronized booleanauthenticate(java.lang.String uid, java.lang.String pw)

        if( isAuthenticated() ) {
            logout();
        }
        try {
            SharedUser u = SharedUser.getUser(uid);

            u.authenticate(pw);
            userID = uid;
            return true;
        }
        catch( AuthenticationException e ) {
            return false;
        }
    
public synchronized booleanauthorize(int prot)

        return (getAuthorization() >= prot);
    
public synchronized booleanchangePassword(java.lang.String opw, java.lang.String npw)

        if( !isAuthenticated() ) {
            return false;
        }
        return getSharedUser().changePassword(opw, npw);
    
public synchronized intgetAuthorization()

        if( !isAuthenticated() ) {
            return 0;
        }
        return getSharedUser().getAuthorization();
    
public synchronized java.lang.StringgetEmail()

        if( !isAuthenticated() ) {
            return null;
        }
        return getSharedUser().getEmail();
    
public synchronized java.lang.StringgetFirstName()

        if( !isAuthenticated() ) {
            return null;
        }
        return getSharedUser().getFirstName();
    
public synchronized java.lang.StringgetLastName()

        if( !isAuthenticated() ) {
            return null;
        }
        return getSharedUser().getLastName();
    
public synchronized java.util.LocalegetLocale()

        Locale loc = getSharedUser().getLocale();

        if( loc == null ) {
            loc = locale;
            if( loc == null ) {
                loc = Locale.getDefault();
            }
        }
        return loc;
    
public synchronized java.lang.StringgetNickname()

        if( !isAuthenticated() ) {
            return null;
        }
        return getSharedUser().getNickname();
    
private SharedUsergetSharedUser()

        if( !isAuthenticated() ) {
            return null;
        }
        return SharedUser.getUser(userID);
    
public synchronized java.lang.StringgetUserID()

        return userID;
    
public synchronized java.lang.StringgetWebPage()

        if( !isAuthenticated() ) {
            return null;
        }
        return getSharedUser().getWebPage();
    
public synchronized booleanisAuthenticated()

        return (userID != null);
    
public synchronized voidlogout()

        if( !isAuthenticated() ) {
            return;
        }
        try {
            getSharedUser().logout();
        }
        catch( PersistenceException e ) {
            // this should NEVER happen
            e.printStackTrace();
        }
        userID = null;
    
public synchronized voidsetLocale(java.util.Locale loc)

        locale = loc;