Add ability to deactivate a user when they leave the project.
Add a inactive column to the Account object. Use the inactive status to disable the user's web and ssh logins, sending emails to the user on behalf of gerrit, adding the user as a reviewer or to a group, and making the user appear in the "add reviewer" and group "add member" auto completion boxes. Bug: issue 503 Change-Id: Ib002788ebf8204dfea608d9f5ac3a5cdff20f817
This commit is contained in:
@@ -17,6 +17,7 @@ package com.google.gerrit.client.rpc;
|
||||
import com.google.gerrit.client.ErrorDialog;
|
||||
import com.google.gerrit.client.Gerrit;
|
||||
import com.google.gerrit.client.NotSignedInDialog;
|
||||
import com.google.gerrit.common.errors.InactiveAccountException;
|
||||
import com.google.gerrit.common.errors.NameAlreadyUsedException;
|
||||
import com.google.gerrit.common.errors.NoSuchAccountException;
|
||||
import com.google.gerrit.common.errors.NoSuchEntityException;
|
||||
@@ -37,6 +38,9 @@ public abstract class GerritCallback<T> implements AsyncCallback<T> {
|
||||
} else if (isNoSuchEntity(caught)) {
|
||||
new ErrorDialog(Gerrit.C.notFoundBody()).center();
|
||||
|
||||
} else if (isInactiveAccount(caught)) {
|
||||
new ErrorDialog(Gerrit.C.inactiveAccountBody()).center();
|
||||
|
||||
} else if (isNoSuchAccount(caught)) {
|
||||
final String msg = caught.getMessage();
|
||||
final String who = msg.substring(NoSuchAccountException.MESSAGE.length());
|
||||
@@ -71,6 +75,11 @@ public abstract class GerritCallback<T> implements AsyncCallback<T> {
|
||||
&& caught.getMessage().equals(NoSuchEntityException.MESSAGE);
|
||||
}
|
||||
|
||||
protected static boolean isInactiveAccount(final Throwable caught) {
|
||||
return caught instanceof RemoteJsonException
|
||||
&& caught.getMessage().startsWith(InactiveAccountException.MESSAGE);
|
||||
}
|
||||
|
||||
private static boolean isNoSuchAccount(final Throwable caught) {
|
||||
return caught instanceof RemoteJsonException
|
||||
&& caught.getMessage().startsWith(NoSuchAccountException.MESSAGE);
|
||||
|
||||
Reference in New Issue
Block a user