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

@@ -15,6 +15,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::{Calendar, CalendarStore};
use serde::{Deserialize, Serialize};
use std::str::FromStr;
@@ -256,8 +257,8 @@ impl<C: CalendarStore + ?Sized> ResourceService for CalendarResourceService<C> {
type Resource = CalendarResource;
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 calendar = self