addressbook_store, add option to not return deleted objects with get_object

#61
This commit is contained in:
Lennart
2025-04-27 18:32:17 +02:00
parent df5f19faab
commit 99388cf992
12 changed files with 71 additions and 46 deletions

View File

@@ -1,17 +1,17 @@
use crate::{
address_object::resource::{AddressObjectPropWrapper, AddressObjectResource},
Error,
address_object::resource::{AddressObjectPropWrapper, AddressObjectResource},
};
use actix_web::{
HttpRequest,
dev::{Path, ResourceDef},
http::StatusCode,
HttpRequest,
};
use rustical_dav::{
resource::Resource,
xml::{multistatus::ResponseElement, MultistatusElement, PropElement, PropfindType},
xml::{MultistatusElement, PropElement, PropfindType, multistatus::ResponseElement},
};
use rustical_store::{auth::User, AddressObject, AddressbookStore};
use rustical_store::{AddressObject, AddressbookStore, auth::User};
use rustical_xml::XmlDeserialize;
#[derive(XmlDeserialize, Clone, Debug, PartialEq)]
@@ -42,7 +42,10 @@ pub async fn get_objects_addressbook_multiget<AS: AddressbookStore>(
not_found.push(href.to_owned());
};
let object_id = path.get("object_id").unwrap();
match store.get_object(principal, addressbook_id, object_id).await {
match store
.get_object(principal, addressbook_id, object_id, false)
.await
{
Ok(object) => result.push(object),
Err(rustical_store::Error::NotFound) => not_found.push(href.to_owned()),
// TODO: Maybe add error handling on a per-object basis