Skip to content

Commit

Permalink
Merge pull request #114 from nextcloud/fixE2EuserID
Browse files Browse the repository at this point in the history
Use provided user ID
  • Loading branch information
AndyScherzinger authored Jan 29, 2018
2 parents 8cf0959 + eefab41 commit 5f6494c
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<Object> keys = new ArrayList<>();
Expand Down

0 comments on commit 5f6494c

Please sign in to comment.