Skip to content

Commit

Permalink
auth-delete and role-get APIs need to check if the graph exists (#1338)
Browse files Browse the repository at this point in the history
Change-Id: I5b76437bd68b1dbbe7bda04c796b9b815104fe20
  • Loading branch information
javeme committed Feb 5, 2021
1 parent 4fbff6a commit 7578e8f
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ public void delete(@Context GraphManager manager,
@PathParam("id") String id) {
LOG.debug("Graph [{}] delete access: {}", graph, id);

@SuppressWarnings("unused") // just check if the graph exists
HugeGraph g = graph(manager, graph);
try {
manager.userManager().deleteAccess(UserAPI.parseId(id));
} catch (NotFoundException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ public void delete(@Context GraphManager manager,
@PathParam("id") String id) {
LOG.debug("Graph [{}] delete belong: {}", graph, id);

@SuppressWarnings("unused") // just check if the graph exists
HugeGraph g = graph(manager, graph);
try {
manager.userManager().deleteBelong(UserAPI.parseId(id));
} catch (NotFoundException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ public void delete(@Context GraphManager manager,
@PathParam("id") String id) {
LOG.debug("Graph [{}] delete group: {}", graph, id);

@SuppressWarnings("unused") // just check if the graph exists
HugeGraph g = graph(manager, graph);
try {
manager.userManager().deleteGroup(IdGenerator.of(id));
} catch (NotFoundException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ public void delete(@Context GraphManager manager,
@PathParam("graph") String graph,
@PathParam("id") String id) {
LOG.debug("Graph [{}] delete target: {}", graph, id);

@SuppressWarnings("unused") // just check if the graph exists
HugeGraph g = graph(manager, graph);
try {
manager.userManager().deleteTarget(UserAPI.parseId(id));
} catch (NotFoundException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ public String role(@Context GraphManager manager,
@PathParam("id") String id) {
LOG.debug("Graph [{}] get user role: {}", graph, id);

@SuppressWarnings("unused") // just check if the graph exists
HugeGraph g = graph(manager, graph);
HugeUser user = manager.userManager().getUser(IdGenerator.of(id));
return manager.userManager().rolePermission(user).toJson();
}
Expand All @@ -149,6 +151,8 @@ public void delete(@Context GraphManager manager,
@PathParam("id") String id) {
LOG.debug("Graph [{}] delete user: {}", graph, id);

@SuppressWarnings("unused") // just check if the graph exists
HugeGraph g = graph(manager, graph);
try {
manager.userManager().deleteUser(IdGenerator.of(id));
} catch (NotFoundException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ protected void updateExistElement(HugeGraph g,
} else if (oldElement.property(key).isPresent() &&
newElement.properties.get(key) == null) {
// If new property is null & old is present, use old property
newElement.properties.put(key, oldElement.property(key).value());
newElement.properties.put(key, oldElement.value(key));
}
}
}
Expand Down

0 comments on commit 7578e8f

Please sign in to comment.