dav: Outsource PrincipalResource AT to where it's actually needed

This commit is contained in:
Lennart
2025-04-19 12:43:32 +02:00
parent 54e327d764
commit 8eb46523a3
10 changed files with 34 additions and 11 deletions

View File

@@ -28,6 +28,8 @@ pub enum CommonPropertiesProp {
}
pub trait CommonPropertiesExtension: Resource {
type PrincipalResource: NamedRoute;
fn get_prop(
&self,
rmap: &ResourceMap,
@@ -66,5 +68,3 @@ pub trait CommonPropertiesExtension: Resource {
Err(crate::Error::PropReadOnly)
}
}
impl<T: Resource> CommonPropertiesExtension for T {}

View File

@@ -26,7 +26,6 @@ impl<T: FromStr> ResourcePropName for T {}
pub trait Resource: Clone + 'static {
type Prop: ResourceProp + PartialEq + Clone + EnumVariants + EnumUnitVariants;
type Error: ResponseError + From<crate::Error>;
type PrincipalResource: Resource + NamedRoute;
type Principal: Principal;
fn get_resourcetype(&self) -> Resourcetype;

View File

@@ -18,10 +18,13 @@ impl<PR: Resource, P: Principal> Default for RootResource<PR, P> {
}
}
impl<PR: Resource + NamedRoute, P: Principal> CommonPropertiesExtension for RootResource<PR, P> {
type PrincipalResource = PR;
}
impl<PR: Resource + NamedRoute, P: Principal> Resource for RootResource<PR, P> {
type Prop = CommonPropertiesProp;
type Error = PR::Error;
type PrincipalResource = PR;
type Principal = P;
fn get_resourcetype(&self) -> Resourcetype {