mirror of
https://github.com/pfzetto/rebacs
synced 2024-11-24 04:02:51 +01:00
related false when objects do not exist
This commit is contained in:
parent
47ab190761
commit
fb68b47c5b
3 changed files with 17 additions and 11 deletions
10
graph.dat
10
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]
|
||||
|
||||
|
|
|
@ -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]
|
||||
|
||||
|
|
|
@ -126,9 +126,11 @@ impl QueryService for GraphService {
|
|||
) -> Result<Response<IsRelatedToResponse>, 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 }))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue