new backend #2

This commit is contained in:
Paul Zinselmeyer 2023-05-01 02:28:17 +02:00
parent 1b53e041e3
commit 0b1af2771c
Signed by: pfzetto
GPG key ID: 4EEF46A5B276E648
2 changed files with 12 additions and 5 deletions

View file

@ -51,10 +51,11 @@ impl RelationService for GraphService {
return Err(Status::invalid_argument("dst.id must be set"));
}
if !graph.has(
if !graph.has_recursive(
("themis_key", &*api_key),
"write",
("themis_ns", &*req_dst.namespace),
u32::MAX,
) {
return Err(Status::permission_denied(
"missing dst.namespace write permissions",
@ -127,10 +128,11 @@ impl RelationService for GraphService {
return Err(Status::invalid_argument("dst.id must be set"));
}
if !graph.has(
if !graph.has_recursive(
("themis_key", &*api_key),
"write",
("themis_ns", &*req_dst.namespace),
u32::MAX,
) {
return Err(Status::permission_denied(
"missing dst.namespace write permissions",
@ -198,10 +200,11 @@ impl RelationService for GraphService {
return Err(Status::invalid_argument("dst.id must be set"));
}
if !graph.has(
if !graph.has_recursive(
("themis_key", &*api_key),
"read",
("themis_ns", &*req_dst.namespace),
u32::MAX,
) {
return Err(Status::permission_denied(
"missing dst.namespace write permissions",
@ -272,13 +275,14 @@ impl QueryService for GraphService {
return Err(Status::invalid_argument("dst.id must be set"));
}
if !graph.has(
if !graph.has_recursive(
("themis_key", &*api_key),
"read",
("themis_ns", &*req_dst.namespace),
u32::MAX,
) {
return Err(Status::permission_denied(
"missing dst.namespace write permissions",
"missing dst.namespace read permissions",
))?;
}

View file

@ -224,6 +224,9 @@ impl RelationSet {
.await
.unwrap();
for (rel, srcs) in rels_srcs.iter() {
if srcs.is_empty() {
continue;
}
let srcs = srcs
.iter()
.map(|src| {