Merge branch 'stable-2.14'
* stable-2.14:
Remove usage of http password get api
Change-Id: I576da6ed3406a65ccb1f962ae123cb2e65d6cb5a
diff --git a/src/main/java/com/googlesource/gerrit/plugins/serviceuser/client/ServiceUserScreen.java b/src/main/java/com/googlesource/gerrit/plugins/serviceuser/client/ServiceUserScreen.java
index c7f6413..78cb65e 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/serviceuser/client/ServiceUserScreen.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/serviceuser/client/ServiceUserScreen.java
@@ -56,47 +56,29 @@
public void onSuccess(final ServiceUserInfo serviceUserInfo) {
new RestApi("config")
.id("server")
- .view(Plugin.get().getPluginName(), "serviceusers")
- .id(serviceUser)
- .view("password.http")
+ .view(Plugin.get().getPluginName(), "config")
.get(
- new AsyncCallback<NativeString>() {
+ new AsyncCallback<ConfigInfo>() {
@Override
- public void onSuccess(final NativeString httpPassword) {
- new RestApi("config")
- .id("server")
- .view(Plugin.get().getPluginName(), "config")
- .get(
- new AsyncCallback<ConfigInfo>() {
- @Override
- public void onSuccess(final ConfigInfo configInfo) {
- AccountCapabilities.all(
- new AsyncCallback<AccountCapabilities>() {
- @Override
- public void onSuccess(AccountCapabilities ac) {
- boolean isAdmin =
- ac.canPerform("administrateServer");
- display(
- serviceUserInfo,
- httpPassword.asString(),
- configInfo.getAllowEmail() || isAdmin,
- configInfo.getAllowOwner() || isAdmin,
- configInfo.getAllowHttpPassword() || isAdmin);
- }
+ public void onSuccess(final ConfigInfo configInfo) {
+ AccountCapabilities.all(
+ new AsyncCallback<AccountCapabilities>() {
+ @Override
+ public void onSuccess(AccountCapabilities ac) {
+ boolean isAdmin = ac.canPerform("administrateServer");
+ display(
+ serviceUserInfo,
+ configInfo.getAllowEmail() || isAdmin,
+ configInfo.getAllowOwner() || isAdmin,
+ configInfo.getAllowHttpPassword() || isAdmin);
+ }
- @Override
- public void onFailure(Throwable caught) {
- // never invoked
- }
- },
- "administrateServer");
- }
-
- @Override
- public void onFailure(Throwable caught) {
- // never invoked
- }
- });
+ @Override
+ public void onFailure(Throwable caught) {
+ // never invoked
+ }
+ },
+ "administrateServer");
}
@Override
@@ -114,11 +96,7 @@
}
private void display(
- ServiceUserInfo info,
- String httpPassword,
- boolean allowEmail,
- boolean allowOwner,
- boolean allowHttpPassword) {
+ ServiceUserInfo info, boolean allowEmail, boolean allowOwner, boolean allowHttpPassword) {
MyTable t = new MyTable();
t.setStyleName("serviceuser-serviceUserInfoTable");
t.addRow("Account State", createActiveToggle(info));
@@ -177,9 +155,7 @@
} else {
t.addRow("Email Address", info.email());
}
- t.addRow(
- "HTTP Password",
- createHttpPasswordWidget(info.username(), httpPassword, allowHttpPassword));
+ t.addRow("HTTP Password", createHttpPasswordWidget(info.username(), allowHttpPassword));
t.addRow("Owner Group", createOwnerWidget(info, allowOwner));
t.addRow("Created By", info.getDisplayName());
t.addRow("Created At", info.created_at());
@@ -242,12 +218,11 @@
return activeToggle;
}
- private Widget createHttpPasswordWidget(
- final String serviceUser, String httpPassword, boolean allowHttpPassword) {
+ private Widget createHttpPasswordWidget(final String serviceUser, boolean allowHttpPassword) {
if (allowHttpPassword) {
HorizontalPanel p = new HorizontalPanel();
- final CopyableLabel label = new CopyableLabel(httpPassword);
- label.setVisible(!httpPassword.isEmpty());
+ final CopyableLabel label = new CopyableLabel("");
+ label.setVisible(false);
p.add(label);
// The redNot icon is only used as temporary measure until gerrit core
@@ -280,7 +255,7 @@
});
}
});
- delete.setVisible(!httpPassword.isEmpty());
+ delete.setVisible(true);
p.add(delete);
Image generate = new Image(ServiceUserPlugin.RESOURCES.gear());
@@ -317,7 +292,7 @@
p.add(generate);
return p;
}
- return new CopyableLabel(httpPassword);
+ return new CopyableLabel("");
}
private Widget createOwnerWidget(ServiceUserInfo info, boolean allowOwner) {