forked from hugegraph/hugegraph-sync
auth-delete and role-get APIs need to check if the graph exists (#1338)
Change-Id: I5b76437bd68b1dbbe7bda04c796b9b815104fe20
This commit is contained in:
parent
4fbff6a1bd
commit
7578e8ff66
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue