Hide Http Password Screen if auth.gitBasicAuth = true

If auth.gitBasicAuth is set to true it is the responsibility of the
container hosting Gerrit to authenticate users for HTTP requests.
The generated HTTP passsword stored in Gerrit is then not used anymore,
hence it is not needed to show the HTTP password screen. It may rather
confuse users that they can generate a password which is of no use.

Change-Id: I6a4efc179b61ee384c7be74459720703a2656ce5
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin 2013-08-23 11:26:15 +02:00
parent 4a82f71b20
commit e59b532878
3 changed files with 14 additions and 1 deletions

View File

@ -30,6 +30,7 @@ public class GerritConfig implements Cloneable {
protected String loginText;
protected String httpPasswordUrl;
protected String reportBugUrl;
protected boolean gitBasicAuth;
protected GitwebConfig gitweb;
protected boolean useContributorAgreements;
@ -90,6 +91,14 @@ public class GerritConfig implements Cloneable {
reportBugUrl = u;
}
public boolean isGitBasicAuth() {
return gitBasicAuth;
}
public void setGitBasicAuth(boolean gba) {
gitBasicAuth = gba;
}
public String getEditFullNameUrl() {
return editFullNameUrl;
}

View File

@ -29,7 +29,9 @@ public abstract class SettingsScreen extends MenuScreen {
if (Gerrit.getConfig().getSshdAddress() != null) {
link(Util.C.tabSshKeys(), PageLinks.SETTINGS_SSHKEYS);
}
link(Util.C.tabHttpAccess(), PageLinks.SETTINGS_HTTP_PASSWORD);
if (!Gerrit.getConfig().isGitBasicAuth()) {
link(Util.C.tabHttpAccess(), PageLinks.SETTINGS_HTTP_PASSWORD);
}
link(Util.C.tabWebIdentities(), PageLinks.SETTINGS_WEBIDENT);
link(Util.C.tabMyGroups(), PageLinks.SETTINGS_MYGROUPS);
if (Gerrit.getConfig().isUseContributorAgreements()) {

View File

@ -131,6 +131,8 @@ class GerritConfigProvider implements Provider<GerritConfig> {
config.setReportBugUrl(null);
}
config.setGitBasicAuth(authConfig.isGitBasichAuth());
final Set<Account.FieldName> fields = new HashSet<Account.FieldName>();
for (final Account.FieldName n : Account.FieldName.values()) {
if (realm.allowsEdit(n)) {