Support SSH key delete for owner
Call the Gerrit delete on-behalf similar to the way AddSshKey is
working so that owners may delete ssh keys if allowSsh is set.
Change-Id: Icecfb61cf329fe1bca95758cff241e308ea60e6d
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
diff --git a/src/main/java/com/googlesource/gerrit/plugins/serviceuser/DeleteSshKey.java b/src/main/java/com/googlesource/gerrit/plugins/serviceuser/DeleteSshKey.java
index 9ce83d3..3257c02 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/serviceuser/DeleteSshKey.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/serviceuser/DeleteSshKey.java
@@ -18,7 +18,6 @@
import com.google.gerrit.extensions.restapi.AuthException;
import com.google.gerrit.extensions.restapi.Response;
import com.google.gerrit.extensions.restapi.RestModifyView;
-import com.google.gerrit.server.account.AccountResource;
import com.google.gerrit.server.permissions.PermissionBackendException;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -40,8 +39,6 @@
public Response<?> apply(ServiceUserResource.SshKey rsrc, Input input)
throws AuthException, RepositoryNotFoundException, IOException, ConfigInvalidException,
PermissionBackendException {
- return deleteSshKey
- .get()
- .apply(new AccountResource.SshKey(rsrc.getUser(), rsrc.getSshKey()), input);
+ return deleteSshKey.get().apply(rsrc.getUser(), rsrc.getSshKey());
}
}