Allow user name to be cleared when unset in LDAP

If the user name is set in Gerrit, but is no longer configured
in LDAP, allow it to be cleared by passing in a null name to the
ChangeUserName action.

Change-Id: Ie52fdf5b899e61456ea268aef93795ca00eed213
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2010-05-04 13:40:07 -07:00
parent b849b72551
commit 3803582f62
2 changed files with 10 additions and 1 deletions

View File

@@ -36,6 +36,8 @@ import java.util.Collections;
import java.util.concurrent.Callable;
import java.util.regex.Pattern;
import javax.annotation.Nullable;
/** Operation to change the username of an account. */
public class ChangeUserName implements Callable<VoidResult> {
private static final Pattern USER_NAME_PATTERN =
@@ -77,7 +79,7 @@ public class ChangeUserName implements Callable<VoidResult> {
final SshKeyCache sshKeyCache,
@Assisted final ReviewDb db, @Assisted final IdentifiedUser user,
@Assisted final String newUsername) {
@Nullable @Assisted final String newUsername) {
this.accountCache = accountCache;
this.sshKeyCache = sshKeyCache;