Added changeEmailAndInvalidate as well as flag manipulation methods.

This commit is contained in:
Michael Bayne
2011-10-21 10:33:34 -07:00
parent 292aba7fde
commit 94b6d1d9f2
@@ -606,6 +606,15 @@ public class DepotUserRepository extends DepotRepository
updatePartial(OOOUserRecord.getKey(userId), OOOUserRecord.EMAIL, email);
}
/**
* Updates the specified user's email address and marks their account as unvalidated.
*/
public void changeEmailAndInvalidate (int userId, String email)
{
updatePartial(OOOUserRecord.getKey(userId), OOOUserRecord.EMAIL, email,
OOOUserRecord.FLAGS, OOOUserRecord.FLAGS.bitAnd(~OOOUser.VALIDATED_FLAG));
}
/**
* Updates the specified user's password (should already be encrypted).
*/
@@ -633,6 +642,24 @@ public class DepotUserRepository extends DepotRepository
return true;
}
/**
* Adds the supplied flags to the specified user's flags.
*/
public void addFlags (int userId, int addMask)
{
updatePartial(OOOUserRecord.getKey(userId),
OOOUserRecord.FLAGS, OOOUserRecord.FLAGS.bitOr(addMask));
}
/**
* Clears the supplied flags from the specified user's flags.
*/
public void clearFlags (int userId, int clearMask)
{
updatePartial(OOOUserRecord.getKey(userId),
OOOUserRecord.FLAGS, OOOUserRecord.FLAGS.bitAnd(~clearMask));
}
/**
* 'Delete' the users account such that they can no longer access it, however we do not delete
* the record from the db. The name is changed such that the original name has XX=FOO if the