Ask user to login if project is not found
Accessing a project URL fails with 'Not Found - The page you requested was not found, or you do not have permission to view this page' if the user is not signed in and the project is not visible to 'Anonymous Users'. Instead Gerrit now asks the user to login and afterwards shows the project to the user if it exists and is visible. If the project doesn't exist or is not visible, the user will still get the NotFoundScreen after sign in. Since we always show the sign in dialog when the user is not signed in and a project is not found, a user can't probe project URLs to find out whether a project exists or not. Change-Id: I99a6ece039dbfa628c07165d6f16d9a70bf3ebae Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
@@ -16,6 +16,7 @@ package com.google.gerrit.client.rpc;
|
||||
|
||||
import com.google.gerrit.client.Gerrit;
|
||||
import com.google.gerrit.client.NotFoundScreen;
|
||||
import com.google.gerrit.client.NotSignedInDialog;
|
||||
import com.google.gerrit.client.ui.Screen;
|
||||
import com.google.gerrit.common.errors.NoSuchEntityException;
|
||||
|
||||
@@ -43,7 +44,11 @@ public abstract class ScreenLoadCallback<T> extends GerritCallback<T> {
|
||||
@Override
|
||||
public void onFailure(final Throwable caught) {
|
||||
if (isNoSuchEntity(caught)) {
|
||||
Gerrit.display(screen.getToken(), new NotFoundScreen());
|
||||
if (Gerrit.isSignedIn()) {
|
||||
Gerrit.display(screen.getToken(), new NotFoundScreen());
|
||||
} else {
|
||||
new NotSignedInDialog().center();
|
||||
}
|
||||
} else {
|
||||
super.onFailure(caught);
|
||||
}
|
||||
|
Reference in New Issue
Block a user