Return info about SSHD with /config/server/info REST endpoint
At the moment we cannot easily provide detailed information about the SSHD configuration from the /config/server/info REST endpoint because in the REST API layer there are no Guice bindings for the SSHD classes and we do not want to pull in all these dependencies. This is why for now the only information that is provided by the /config/server/info REST endpoint is whether SSHD is enabled or not. If SSHD is enabled an empty SshdInfo is included into the ServerInfo JSON entity. If SSHD is disabled, the 'sshd' field in ServerInfo is not set. Using an empty SshdInfo entity instead of a boolean field allows us to provide more details in future without breaking the API. Knowing whether SSHD is enabled is at the moment sufficient for the Gerrit Client, other SSHD information is not needed. Change-Id: Ibb66c8ec9ce3fba32dd9c68e7267333d524d0e2d Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
@@ -99,7 +99,7 @@ public class RegisterScreen extends AccountScreen {
|
||||
formBody.add(fp);
|
||||
}
|
||||
|
||||
if (Gerrit.getConfig().getSshdAddress() != null) {
|
||||
if (Gerrit.info().hasSshd()) {
|
||||
final FlowPanel sshKeyGroup = new FlowPanel();
|
||||
sshKeyGroup.setStyleName(Gerrit.RESOURCES.css().registerScreenSection());
|
||||
sshKeyGroup.add(new SmallHeading(Util.C.welcomeSshKeyHeading()));
|
||||
|
||||
@@ -26,7 +26,7 @@ public abstract class SettingsScreen extends MenuScreen {
|
||||
link(Util.C.tabPreferences(), PageLinks.SETTINGS_PREFERENCES);
|
||||
link(Util.C.tabWatchedProjects(), PageLinks.SETTINGS_PROJECTS);
|
||||
link(Util.C.tabContactInformation(), PageLinks.SETTINGS_CONTACT);
|
||||
if (Gerrit.getConfig().getSshdAddress() != null) {
|
||||
if (Gerrit.info().hasSshd()) {
|
||||
link(Util.C.tabSshKeys(), PageLinks.SETTINGS_SSHKEYS);
|
||||
}
|
||||
if (Gerrit.info().auth().isHttpPasswordSettingsEnabled()) {
|
||||
|
||||
@@ -23,6 +23,7 @@ public class ServerInfo extends JavaScriptObject {
|
||||
public final native DownloadInfo download() /*-{ return this.download; }-*/;
|
||||
public final native GerritInfo gerrit() /*-{ return this.gerrit; }-*/;
|
||||
public final native GitWebInfo gitWeb() /*-{ return this.git_web; }-*/;
|
||||
public final native SshdInfo sshd() /*-{ return this.sshd; }-*/;
|
||||
public final native SuggestInfo suggest() /*-{ return this.suggest; }-*/;
|
||||
public final native UserConfigInfo user() /*-{ return this.user; }-*/;
|
||||
|
||||
@@ -30,6 +31,10 @@ public class ServerInfo extends JavaScriptObject {
|
||||
return contactStore() != null;
|
||||
}
|
||||
|
||||
public final boolean hasSshd() {
|
||||
return sshd() != null;
|
||||
}
|
||||
|
||||
protected ServerInfo() {
|
||||
}
|
||||
|
||||
@@ -51,6 +56,11 @@ public class ServerInfo extends JavaScriptObject {
|
||||
}
|
||||
}
|
||||
|
||||
public static class SshdInfo extends JavaScriptObject {
|
||||
protected SshdInfo() {
|
||||
}
|
||||
}
|
||||
|
||||
public static class SuggestInfo extends JavaScriptObject {
|
||||
public final native int from() /*-{ return this.from || 0; }-*/;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user