mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 01:12:24 +00:00
Refactoring around routing and getting the principal uri (less dependence on actix)
This commit is contained in:
@@ -2,10 +2,8 @@ use super::methods::mkcol::route_mkcol;
|
||||
use super::methods::post::route_post;
|
||||
use super::methods::report::route_report_addressbook;
|
||||
use super::prop::{SupportedAddressData, SupportedReportSet};
|
||||
use crate::Error;
|
||||
use crate::address_object::resource::AddressObjectResource;
|
||||
use crate::principal::PrincipalResource;
|
||||
use actix_web::dev::ResourceMap;
|
||||
use crate::{CardDavPrincipalUri, Error};
|
||||
use actix_web::http::Method;
|
||||
use actix_web::web;
|
||||
use async_trait::async_trait;
|
||||
@@ -14,7 +12,7 @@ use rustical_dav::extensions::{
|
||||
CommonPropertiesExtension, CommonPropertiesProp, SyncTokenExtension, SyncTokenExtensionProp,
|
||||
};
|
||||
use rustical_dav::privileges::UserPrivilegeSet;
|
||||
use rustical_dav::resource::{Resource, ResourceService};
|
||||
use rustical_dav::resource::{PrincipalUri, Resource, ResourceService};
|
||||
use rustical_dav::xml::{Resourcetype, ResourcetypeInner};
|
||||
use rustical_dav_push::{DavPushExtension, DavPushExtensionProp};
|
||||
use rustical_store::auth::User;
|
||||
@@ -80,10 +78,6 @@ impl DavPushExtension for AddressbookResource {
|
||||
}
|
||||
}
|
||||
|
||||
impl CommonPropertiesExtension for AddressbookResource {
|
||||
type PrincipalResource = PrincipalResource;
|
||||
}
|
||||
|
||||
impl Resource for AddressbookResource {
|
||||
type Prop = AddressbookPropWrapper;
|
||||
type Error = Error;
|
||||
@@ -98,7 +92,7 @@ impl Resource for AddressbookResource {
|
||||
|
||||
fn get_prop(
|
||||
&self,
|
||||
rmap: &ResourceMap,
|
||||
puri: &impl PrincipalUri,
|
||||
user: &User,
|
||||
prop: &AddressbookPropWrapperName,
|
||||
) -> Result<Self::Prop, Self::Error> {
|
||||
@@ -130,7 +124,7 @@ impl Resource for AddressbookResource {
|
||||
AddressbookPropWrapper::DavPush(<Self as DavPushExtension>::get_prop(self, prop)?)
|
||||
}
|
||||
AddressbookPropWrapperName::Common(prop) => AddressbookPropWrapper::Common(
|
||||
CommonPropertiesExtension::get_prop(self, rmap, user, prop)?,
|
||||
CommonPropertiesExtension::get_prop(self, puri, user, prop)?,
|
||||
),
|
||||
})
|
||||
}
|
||||
@@ -204,6 +198,7 @@ impl<AS: AddressbookStore, S: SubscriptionStore> ResourceService
|
||||
type Resource = AddressbookResource;
|
||||
type Error = Error;
|
||||
type Principal = User;
|
||||
type PrincipalUri = CardDavPrincipalUri;
|
||||
|
||||
async fn get_resource(
|
||||
&self,
|
||||
|
||||
Reference in New Issue
Block a user