Widening, made getDirtyMask() public.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2567 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -26,14 +26,13 @@ import com.samskivert.jdbc.jora.FieldMask;
|
|||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A user object contains information about a registered user in our web
|
* A user object contains information about a registered user in our web application environment.
|
||||||
* application environment. Users are stored in the user repository (a
|
* Users are stored in the user repository (a database table) and loaded during a request based on
|
||||||
* database table) and loaded during a request based on authentication
|
* authentication information provided with the request headers.
|
||||||
* information provided with the request headers.
|
|
||||||
*
|
*
|
||||||
* <p><b>Note:</b> Do not modify any of the fields of this object
|
* <p><b>Note:</b> Do not modify any of the fields of this object directly. Use the
|
||||||
* directly. Use the <code>set</code> methods to make updates. If no set
|
* <code>set</code> methods to make updates. If no set methods exist, you shouldn't be modifying
|
||||||
* methods exist, you shouldn't be modifying that field.
|
* that field.
|
||||||
*/
|
*/
|
||||||
public class User
|
public class User
|
||||||
{
|
{
|
||||||
@@ -46,8 +45,7 @@ public class User
|
|||||||
/** The date this record was created. */
|
/** The date this record was created. */
|
||||||
public Date created;
|
public Date created;
|
||||||
|
|
||||||
/** The user's real name (first, last and whatever else they opt to
|
/** The user's real name (first, last and whatever else they opt to provide). */
|
||||||
* provide). */
|
|
||||||
public String realname;
|
public String realname;
|
||||||
|
|
||||||
/** The user's chosen password (encrypted). */
|
/** The user's chosen password (encrypted). */
|
||||||
@@ -56,8 +54,8 @@ public class User
|
|||||||
/** The user's email address. */
|
/** The user's email address. */
|
||||||
public String email;
|
public String email;
|
||||||
|
|
||||||
/** The site identifier of the site through which the user created
|
/** The site identifier of the site through which the user created their account. (Their
|
||||||
* their account. (Their affiliation, if you will.) */
|
* affiliation, if you will.) */
|
||||||
public int siteId;
|
public int siteId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -117,24 +115,19 @@ public class User
|
|||||||
{
|
{
|
||||||
// we may have an old crypt() encrypted password
|
// we may have an old crypt() encrypted password
|
||||||
if (this.password.length() == 13) {
|
if (this.password.length() == 13) {
|
||||||
// check both the case sensitive and insensitive versions for
|
// check both the case sensitive and insensitive versions for further legacy reasons
|
||||||
// further legacy reasons
|
if (this.password.equals(UserUtil.legacyEncrypt(username, password, false)) ||
|
||||||
if (this.password.equals(
|
this.password.equals(UserUtil.legacyEncrypt(username, password, true))) {
|
||||||
UserUtil.legacyEncrypt(username, password, false)) ||
|
|
||||||
this.password.equals(
|
|
||||||
UserUtil.legacyEncrypt(username, password, true))) {
|
|
||||||
// update our password with the new encryption method
|
// update our password with the new encryption method
|
||||||
setPassword(password);
|
setPassword(password);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compares the supplied password with the password associated with
|
* Compares the supplied password with the password associated with this user record.
|
||||||
* this user record.
|
|
||||||
*
|
*
|
||||||
* @return true if the passwords match, false if they do not.
|
* @return true if the passwords match, false if they do not.
|
||||||
*/
|
*/
|
||||||
@@ -153,8 +146,8 @@ public class User
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this user is an admin, false otherwise. The default
|
* Returns true if this user is an admin, false otherwise. The default implementation does not
|
||||||
* implementation does not track admin status and always returns false.
|
* track admin status and always returns false.
|
||||||
*/
|
*/
|
||||||
public boolean isAdmin ()
|
public boolean isAdmin ()
|
||||||
{
|
{
|
||||||
@@ -162,29 +155,29 @@ public class User
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by the repository to find out which fields have been
|
* Called by the repository to find out which fields have been modified since the object was
|
||||||
* modified since the object was loaded.
|
* loaded.
|
||||||
*/
|
*/
|
||||||
protected FieldMask getDirtyMask ()
|
public FieldMask getDirtyMask ()
|
||||||
{
|
{
|
||||||
return _dirty;
|
return _dirty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override // from Object
|
||||||
|
public String toString ()
|
||||||
|
{
|
||||||
|
return StringUtil.fieldsToString(this);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by the repository to configure this user record with a field
|
* Called by the repository to configure this user record with a field mask that it can use to
|
||||||
* mask that it can use to track modified fields.
|
* track modified fields.
|
||||||
*/
|
*/
|
||||||
protected void setDirtyMask (FieldMask dirty)
|
protected void setDirtyMask (FieldMask dirty)
|
||||||
{
|
{
|
||||||
_dirty = dirty;
|
_dirty = dirty;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString ()
|
|
||||||
{
|
|
||||||
return StringUtil.fieldsToString(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Our dirty field mask. */
|
/** Our dirty field mask. */
|
||||||
protected transient FieldMask _dirty;
|
protected transient FieldMask _dirty;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user