diff --git a/graph.dat b/graph.dat index c4f5c07..b723c60 100644 --- a/graph.dat +++ b/graph.dat @@ -1,10 +1,12 @@ -[user:bob] +[test:hello] [doc:foo] -read = [doc:foo#owner, user:bob] owner = [user:alice] - -[user:oscar] +read = [user:bob, doc:foo#owner] [user:alice] +[user:bob] + +[user:oscar] + diff --git a/graph.dat.bak b/graph.dat.bak index 9dc7a90..20ee74e 100644 --- a/graph.dat.bak +++ b/graph.dat.bak @@ -1,10 +1,12 @@ -[user:bob] +[test:hello] [doc:foo] -read = [user:bob, doc:foo#owner] +read = [doc:foo#owner, user:bob] owner = [user:alice] -[user:oscar] - [user:alice] +[user:bob] + +[user:oscar] + diff --git a/src/grpc_service.rs b/src/grpc_service.rs index 0d8856a..04f5bf0 100644 --- a/src/grpc_service.rs +++ b/src/grpc_service.rs @@ -126,9 +126,11 @@ impl QueryService for GraphService { ) -> Result, Status> { let graph = self.graph.lock().await; - let (src, dst) = transform_relation(request.get_ref(), &graph)?; - - let related = graph.is_related_to(src, dst); + let related = if let Ok((src, dst)) = transform_relation(request.get_ref(), &graph) { + graph.is_related_to(src, dst) + } else { + false + }; Ok(Response::new(IsRelatedToResponse { related })) }