ch.uzh.ifi.attempto.acewiki.core
Class User

java.lang.Object
  extended by ch.uzh.ifi.attempto.acewiki.core.User

public class User
extends java.lang.Object

This class represents an AceWiki user.

Author:
Tobias Kuhn

Method Summary
 void addToUserDataCounter(java.lang.String name, int c)
          Adds to a counter in the user data.
 void changePassword(java.lang.String oldPw, java.lang.String newPw)
          Changes the password for the user.
 java.lang.String getHashedPassword()
          Returns the hashed password.
 long getId()
          Returns the id of the user.
 java.lang.String getName()
          Returns the name of the user.
static java.lang.String getPasswordHash(java.lang.String password)
          Returns a hash value for a given plain-text password using the SHA-256 algorithm.
 UserBase getUserBase()
          Returns the user base to which this user belongs.
 java.lang.String getUserData(java.lang.String name)
          Returns the user data with the given property name.
 java.util.List<java.lang.String> getUserDataKeys()
          Returns all key of this user's properties in the form of key/value pairs.
 boolean isCorrectPassword(java.lang.String pw)
          Checks whether a certain password is the correct password for this user.
 void setUserData(java.lang.String name, java.lang.String value)
          Sets the user data element with the respective name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getId

public long getId()
Returns the id of the user.

Returns:
The id.

getName

public java.lang.String getName()
Returns the name of the user.

Returns:
The name of the user.

getHashedPassword

public java.lang.String getHashedPassword()
Returns the hashed password.

Returns:
The hashed password.

getUserData

public java.lang.String getUserData(java.lang.String name)
Returns the user data with the given property name.

Parameters:
name - The property name.
Returns:
The data for the respective name.

setUserData

public void setUserData(java.lang.String name,
                        java.lang.String value)
Sets the user data element with the respective name.

Parameters:
name - The name of the user data element.
value - The value to be set.

changePassword

public void changePassword(java.lang.String oldPw,
                           java.lang.String newPw)
Changes the password for the user.

Parameters:
oldPw - The old password in plain text.
newPw - The new password in plain text.

addToUserDataCounter

public void addToUserDataCounter(java.lang.String name,
                                 int c)
Adds to a counter in the user data.

Parameters:
name - The name of the user data element.
c - The value by which the counter should be increased.

isCorrectPassword

public boolean isCorrectPassword(java.lang.String pw)
Checks whether a certain password is the correct password for this user.

Parameters:
pw - The password to be checked in plain text.
Returns:
true if the password is correct.

getPasswordHash

public static java.lang.String getPasswordHash(java.lang.String password)
Returns a hash value for a given plain-text password using the SHA-256 algorithm.

Parameters:
password - The plain-text password for which a hash value should be created.
Returns:
The hash value.

getUserBase

public UserBase getUserBase()
Returns the user base to which this user belongs.

Returns:
The user base.

getUserDataKeys

public java.util.List<java.lang.String> getUserDataKeys()
Returns all key of this user's properties in the form of key/value pairs.

Returns:
All user data keys.


Copyright 2008-2012, AceWiki developers