imbajin commented on code in PR #760:
URL:
https://github.com/apache/hugegraph-toolchain/pull/760#discussion_r3921145179
##########
hugegraph-client/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java:
##########
@@ -70,8 +79,19 @@ public List<User> list(int limit) {
}
public User getByName(String name) {
- Map<String, Object> params = ImmutableMap.of("name", name);
+ Map<String, Object> params = this.legacyGraphScoped ?
+ ImmutableMap.of("limit", -1) :
+ ImmutableMap.of("name", name);
RestResult result = this.client.get(this.path(), params);
+ if (this.legacyGraphScoped) {
+ List<User> users = result.readList(this.type(), User.class);
+ for (User user : users) {
+ if (name.equals(user.name())) {
+ return user;
+ }
+ }
+ return null;
Review Comment:
Fixed in a12819b2. Legacy misses now throw a clear ClientException, and the
regression coverage includes both an absent username and the graph-null
fallback.
##########
hugegraph-client/src/main/java/org/apache/hugegraph/driver/AuthManager.java:
##########
@@ -66,7 +66,7 @@ public AuthManager(RestClient client, String graphSpace,
String graph) {
this.targetAPI = new TargetAPI(client, graphSpace);
this.groupAPI = new GroupAPI(client);
this.graphSpaceGroupAPI = new GroupAPI(client, graphSpace);
- this.userAPI = new UserAPI(client, graphSpace);
+ this.userAPI = new UserAPI(client, graphSpace, graph);
Review Comment:
Confirmed as a broader pre-existing legacy-auth gap, but it is intentionally
outside this UserAPI-focused PR. Hubble 1.5 support is limited to non-auth
standalone mode, so no follow-up is needed unless legacy authenticated mode
becomes a supported target.
##########
hugegraph-client/src/main/java/org/apache/hugegraph/api/auth/UserAPI.java:
##########
@@ -30,8 +30,17 @@
public class UserAPI extends AuthAPI {
+ private final boolean legacyGraphScoped;
+
public UserAPI(RestClient client, String graphSpace) {
super(client, graphSpace);
+ this.legacyGraphScoped = false;
+ }
+
+ public UserAPI(RestClient client, String graphSpace, String graph) {
+ super(client, graphSpace, graph);
+ this.legacyGraphScoped = !client.isSupportGs() &&
Review Comment:
Fixed in a12819b2. AuthAPI now owns the legacy-path decision, UserAPI reads
that single source, and the legacy lookup reuses list(-1).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]