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

@@ -6,6 +6,7 @@ use actix_web::HttpRequest;
use async_trait::async_trait;
use rustical_dav::resource::{InvalidProperty, Resource, ResourceService};
use rustical_dav::xml::HrefElement;
use rustical_store::auth::User;
use rustical_store::AddressbookStore;
use serde::{Deserialize, Serialize};
use std::sync::Arc;
@@ -121,8 +122,8 @@ impl<A: AddressbookStore + ?Sized> ResourceService for PrincipalResourceService<
})
}
async fn get_resource(&self, principal: String) -> Result<Self::Resource, Self::Error> {
if self.principal != principal {
async fn get_resource(&self, user: User) -> Result<Self::Resource, Self::Error> {
if self.principal != user.id {
return Err(Error::Unauthorized);
}
Ok(PrincipalResource {