From eefab416f138929ea4fae927fec03c75e8c297e0 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Mon, 29 Jan 2018 11:26:27 +0100 Subject: [PATCH] use provided user ID Signed-off-by: tobiasKaminsky --- .../lib/resources/users/GetPublicKeyOperation.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/com/owncloud/android/lib/resources/users/GetPublicKeyOperation.java b/src/com/owncloud/android/lib/resources/users/GetPublicKeyOperation.java index 0b06d5d18..8ca4e5140 100644 --- a/src/com/owncloud/android/lib/resources/users/GetPublicKeyOperation.java +++ b/src/com/owncloud/android/lib/resources/users/GetPublicKeyOperation.java @@ -49,6 +49,12 @@ public class GetPublicKeyOperation extends RemoteOperation { private static final String NODE_PUBLIC_KEYS = "public-keys"; private static final String JSON_FORMAT = "?format=json"; + + private String userID; + + public GetPublicKeyOperation(String userID) { + this.userID = userID; + } /** * @param client Client object @@ -69,10 +75,9 @@ protected RemoteOperationResult run(OwnCloudClient client) { String response = getMethod.getResponseBodyAsString(); // Parse the response - String username = client.getCredentials().getUsername(); JSONObject respJSON = new JSONObject(response); String key = (String) respJSON.getJSONObject(NODE_OCS).getJSONObject(NODE_DATA) - .getJSONObject(NODE_PUBLIC_KEYS).get(username); + .getJSONObject(NODE_PUBLIC_KEYS).get(userID); result = new RemoteOperationResult(true, getMethod); ArrayList keys = new ArrayList<>();