mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 20:32:48 +00:00
dav: Outsource PrincipalResource AT to where it's actually needed
This commit is contained in:
@@ -100,10 +100,13 @@ impl DavPushExtension for CalendarResource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl CommonPropertiesExtension for CalendarResource {
|
||||||
|
type PrincipalResource = PrincipalResource;
|
||||||
|
}
|
||||||
|
|
||||||
impl Resource for CalendarResource {
|
impl Resource for CalendarResource {
|
||||||
type Prop = CalendarPropWrapper;
|
type Prop = CalendarPropWrapper;
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
type PrincipalResource = PrincipalResource;
|
|
||||||
type Principal = User;
|
type Principal = User;
|
||||||
|
|
||||||
fn get_resourcetype(&self) -> Resourcetype {
|
fn get_resourcetype(&self) -> Resourcetype {
|
||||||
|
|||||||
@@ -51,10 +51,13 @@ pub struct CalendarObjectResource {
|
|||||||
pub principal: String,
|
pub principal: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl CommonPropertiesExtension for CalendarObjectResource {
|
||||||
|
type PrincipalResource = PrincipalResource;
|
||||||
|
}
|
||||||
|
|
||||||
impl Resource for CalendarObjectResource {
|
impl Resource for CalendarObjectResource {
|
||||||
type Prop = CalendarObjectPropWrapper;
|
type Prop = CalendarObjectPropWrapper;
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
type PrincipalResource = PrincipalResource;
|
|
||||||
type Principal = User;
|
type Principal = User;
|
||||||
|
|
||||||
fn get_resourcetype(&self) -> Resourcetype {
|
fn get_resourcetype(&self) -> Resourcetype {
|
||||||
|
|||||||
@@ -24,10 +24,13 @@ pub enum PrincipalPropWrapper {
|
|||||||
Common(CommonPropertiesProp),
|
Common(CommonPropertiesProp),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl CommonPropertiesExtension for CalendarSetResource {
|
||||||
|
type PrincipalResource = PrincipalResource;
|
||||||
|
}
|
||||||
|
|
||||||
impl Resource for CalendarSetResource {
|
impl Resource for CalendarSetResource {
|
||||||
type Prop = PrincipalPropWrapper;
|
type Prop = PrincipalPropWrapper;
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
type PrincipalResource = PrincipalResource;
|
|
||||||
type Principal = User;
|
type Principal = User;
|
||||||
|
|
||||||
fn get_resourcetype(&self) -> Resourcetype {
|
fn get_resourcetype(&self) -> Resourcetype {
|
||||||
|
|||||||
@@ -61,10 +61,13 @@ impl NamedRoute for PrincipalResource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl CommonPropertiesExtension for PrincipalResource {
|
||||||
|
type PrincipalResource = Self;
|
||||||
|
}
|
||||||
|
|
||||||
impl Resource for PrincipalResource {
|
impl Resource for PrincipalResource {
|
||||||
type Prop = PrincipalPropWrapper;
|
type Prop = PrincipalPropWrapper;
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
type PrincipalResource = PrincipalResource;
|
|
||||||
type Principal = User;
|
type Principal = User;
|
||||||
|
|
||||||
fn get_resourcetype(&self) -> Resourcetype {
|
fn get_resourcetype(&self) -> Resourcetype {
|
||||||
|
|||||||
@@ -47,10 +47,13 @@ pub struct AddressObjectResource {
|
|||||||
pub principal: String,
|
pub principal: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl CommonPropertiesExtension for AddressObjectResource {
|
||||||
|
type PrincipalResource = PrincipalResource;
|
||||||
|
}
|
||||||
|
|
||||||
impl Resource for AddressObjectResource {
|
impl Resource for AddressObjectResource {
|
||||||
type Prop = AddressObjectPropWrapper;
|
type Prop = AddressObjectPropWrapper;
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
type PrincipalResource = PrincipalResource;
|
|
||||||
type Principal = User;
|
type Principal = User;
|
||||||
|
|
||||||
fn get_resourcetype(&self) -> Resourcetype {
|
fn get_resourcetype(&self) -> Resourcetype {
|
||||||
|
|||||||
@@ -80,10 +80,13 @@ impl DavPushExtension for AddressbookResource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl CommonPropertiesExtension for AddressbookResource {
|
||||||
|
type PrincipalResource = PrincipalResource;
|
||||||
|
}
|
||||||
|
|
||||||
impl Resource for AddressbookResource {
|
impl Resource for AddressbookResource {
|
||||||
type Prop = AddressbookPropWrapper;
|
type Prop = AddressbookPropWrapper;
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
type PrincipalResource = PrincipalResource;
|
|
||||||
type Principal = User;
|
type Principal = User;
|
||||||
|
|
||||||
fn get_resourcetype(&self) -> Resourcetype {
|
fn get_resourcetype(&self) -> Resourcetype {
|
||||||
|
|||||||
@@ -70,10 +70,13 @@ impl NamedRoute for PrincipalResource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl CommonPropertiesExtension for PrincipalResource {
|
||||||
|
type PrincipalResource = Self;
|
||||||
|
}
|
||||||
|
|
||||||
impl Resource for PrincipalResource {
|
impl Resource for PrincipalResource {
|
||||||
type Prop = PrincipalPropWrapper;
|
type Prop = PrincipalPropWrapper;
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
type PrincipalResource = PrincipalResource;
|
|
||||||
type Principal = User;
|
type Principal = User;
|
||||||
|
|
||||||
fn get_resourcetype(&self) -> Resourcetype {
|
fn get_resourcetype(&self) -> Resourcetype {
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ pub enum CommonPropertiesProp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub trait CommonPropertiesExtension: Resource {
|
pub trait CommonPropertiesExtension: Resource {
|
||||||
|
type PrincipalResource: NamedRoute;
|
||||||
|
|
||||||
fn get_prop(
|
fn get_prop(
|
||||||
&self,
|
&self,
|
||||||
rmap: &ResourceMap,
|
rmap: &ResourceMap,
|
||||||
@@ -66,5 +68,3 @@ pub trait CommonPropertiesExtension: Resource {
|
|||||||
Err(crate::Error::PropReadOnly)
|
Err(crate::Error::PropReadOnly)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Resource> CommonPropertiesExtension for T {}
|
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ impl<T: FromStr> ResourcePropName for T {}
|
|||||||
pub trait Resource: Clone + 'static {
|
pub trait Resource: Clone + 'static {
|
||||||
type Prop: ResourceProp + PartialEq + Clone + EnumVariants + EnumUnitVariants;
|
type Prop: ResourceProp + PartialEq + Clone + EnumVariants + EnumUnitVariants;
|
||||||
type Error: ResponseError + From<crate::Error>;
|
type Error: ResponseError + From<crate::Error>;
|
||||||
type PrincipalResource: Resource + NamedRoute;
|
|
||||||
type Principal: Principal;
|
type Principal: Principal;
|
||||||
|
|
||||||
fn get_resourcetype(&self) -> Resourcetype;
|
fn get_resourcetype(&self) -> Resourcetype;
|
||||||
|
|||||||
@@ -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> {
|
impl<PR: Resource + NamedRoute, P: Principal> Resource for RootResource<PR, P> {
|
||||||
type Prop = CommonPropertiesProp;
|
type Prop = CommonPropertiesProp;
|
||||||
type Error = PR::Error;
|
type Error = PR::Error;
|
||||||
type PrincipalResource = PR;
|
|
||||||
type Principal = P;
|
type Principal = P;
|
||||||
|
|
||||||
fn get_resourcetype(&self) -> Resourcetype {
|
fn get_resourcetype(&self) -> Resourcetype {
|
||||||
|
|||||||
Reference in New Issue
Block a user