Improvement to access control

This commit is contained in:
Lennart
2024-10-31 21:18:41 +01:00
parent c484a17911
commit 0c14f8ba90
24 changed files with 394 additions and 215 deletions

View File

@@ -16,7 +16,7 @@ use rustical_dav::{
MultistatusElement,
},
};
use rustical_store::{AddressObject, AddressbookStore};
use rustical_store::{auth::User, AddressObject, AddressbookStore};
use serde::Deserialize;
#[derive(Deserialize, Clone, Debug)]
@@ -64,6 +64,7 @@ pub async fn get_objects_addressbook_multiget<AS: AddressbookStore + ?Sized>(
pub async fn handle_addressbook_multiget<AS: AddressbookStore + ?Sized>(
addr_multiget: AddressbookMultigetRequest,
req: HttpRequest,
user: &User,
principal: &str,
cal_id: &str,
addr_store: &AS,
@@ -92,11 +93,13 @@ pub async fn handle_addressbook_multiget<AS: AddressbookStore + ?Sized>(
let mut responses = Vec::new();
for object in objects {
let path = format!("{}/{}", req.path(), object.get_id());
responses.push(AddressObjectResource::from(object).propfind(
&path,
props.clone(),
req.resource_map(),
)?);
responses.push(
AddressObjectResource {
object,
principal: principal.to_owned(),
}
.propfind(&path, props.clone(), user, req.resource_map())?,
);
}
let not_found_responses = not_found