dav: get_resource replace principal with User

This commit is contained in:
Lennart
2024-10-31 18:20:43 +01:00
parent a136f86ca7
commit eab03fef6b
11 changed files with 28 additions and 21 deletions

View File

@@ -12,6 +12,7 @@ use async_trait::async_trait;
use derive_more::derive::{From, Into};
use rustical_dav::resource::{InvalidProperty, Resource, ResourceService};
use rustical_dav::xml::HrefElement;
use rustical_store::auth::User;
use rustical_store::{Addressbook, AddressbookStore};
use serde::{Deserialize, Serialize};
use std::str::FromStr;
@@ -196,8 +197,8 @@ impl<AS: AddressbookStore + ?Sized> ResourceService for AddressbookResourceServi
type Resource = AddressbookResource;
type Error = Error;
async fn get_resource(&self, principal: String) -> Result<Self::Resource, Error> {
if self.principal != principal {
async fn get_resource(&self, user: User) -> Result<Self::Resource, Error> {
if self.principal != user.id {
return Err(Error::Unauthorized);
}
let addressbook = self