auth-delete and role-get APIs need to check if the graph exists (#1338)

Change-Id: I5b76437bd68b1dbbe7bda04c796b9b815104fe20
This commit is contained in:
Jermy Li 2021-01-30 16:52:19 +08:00 committed by Zhangmei Li
parent 4fbff6a1bd
commit 7578e8ff66
6 changed files with 14 additions and 1 deletions

View File

@ -149,6 +149,8 @@ public class AccessAPI extends API {
@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) {

View File

@ -148,6 +148,8 @@ public class BelongAPI extends API {
@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) {

View File

@ -134,6 +134,8 @@ public class GroupAPI extends API {
@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) {

View File

@ -134,6 +134,9 @@ public class TargetAPI extends API {
@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) {

View File

@ -136,6 +136,8 @@ public class UserAPI extends API {
@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();
}
@ -149,6 +151,8 @@ public class UserAPI extends API {
@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) {

View File

@ -148,7 +148,7 @@ public class BatchAPI extends API {
} 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));
}
}
}