Implement supported-report-set property for calendar collection

This commit is contained in:
Lennart
2024-07-27 12:36:18 +02:00
parent 0eb71911c0
commit 8d9dba364d
3 changed files with 48 additions and 1 deletions

View File

@@ -34,6 +34,8 @@ a calendar server
## Relevant RFCs ## Relevant RFCs
- Versioning Extensions to WebDAV: [RFC 3253](https://datatracker.ietf.org/doc/html/rfc3253)
- provides the REPORT method
- Calendaring Extensions to WebDAV (CalDAV): [RFC 4791](https://datatracker.ietf.org/doc/html/rfc4791) - Calendaring Extensions to WebDAV (CalDAV): [RFC 4791](https://datatracker.ietf.org/doc/html/rfc4791)
- Scheduling Extensions to CalDAV: [RFC 6638](https://datatracker.ietf.org/doc/html/rfc6638) - Scheduling Extensions to CalDAV: [RFC 6638](https://datatracker.ietf.org/doc/html/rfc6638)
- not sure yet whether to implement this - not sure yet whether to implement this

View File

@@ -95,3 +95,41 @@ impl Default for UserPrivilegeSet {
} }
} }
} }
#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case")]
pub enum ReportMethod {
CalendarQuery,
CalendarMultiget,
// SyncCollection,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case")]
pub struct SupportedReport {
report: ReportMethod,
}
impl From<ReportMethod> for SupportedReport {
fn from(value: ReportMethod) -> Self {
Self { report: value }
}
}
#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case")]
pub struct SupportedReportSet {
supported_report: Vec<SupportedReport>,
}
impl Default for SupportedReportSet {
fn default() -> Self {
Self {
supported_report: vec![
ReportMethod::CalendarQuery.into(),
ReportMethod::CalendarMultiget.into(),
// ReportMethod::SyncCollection.into(),
],
}
}
}

View File

@@ -15,7 +15,7 @@ use tokio::sync::RwLock;
use super::prop::{ use super::prop::{
Resourcetype, SupportedCalendarComponent, SupportedCalendarComponentSet, SupportedCalendarData, Resourcetype, SupportedCalendarComponent, SupportedCalendarComponentSet, SupportedCalendarData,
UserPrivilegeSet, SupportedReportSet, UserPrivilegeSet,
}; };
pub struct CalendarResource<C: CalendarStore + ?Sized> { pub struct CalendarResource<C: CalendarStore + ?Sized> {
@@ -41,6 +41,7 @@ pub enum CalendarPropName {
Getcontenttype, Getcontenttype,
CurrentUserPrivilegeSet, CurrentUserPrivilegeSet,
MaxResourceSize, MaxResourceSize,
SupportedReportSet,
} }
#[derive(Debug, Clone, Deserialize, Serialize)] #[derive(Debug, Clone, Deserialize, Serialize)]
@@ -71,6 +72,7 @@ pub enum CalendarProp {
Getcontenttype(String), Getcontenttype(String),
MaxResourceSize(String), MaxResourceSize(String),
CurrentUserPrivilegeSet(UserPrivilegeSet), CurrentUserPrivilegeSet(UserPrivilegeSet),
SupportedReportSet(SupportedReportSet),
#[serde(other)] #[serde(other)]
Invalid, Invalid,
} }
@@ -138,6 +140,9 @@ impl Resource for CalendarFile {
CalendarPropName::CurrentUserPrivilegeSet => Ok(CalendarProp::CurrentUserPrivilegeSet( CalendarPropName::CurrentUserPrivilegeSet => Ok(CalendarProp::CurrentUserPrivilegeSet(
UserPrivilegeSet::default(), UserPrivilegeSet::default(),
)), )),
CalendarPropName::SupportedReportSet => Ok(CalendarProp::SupportedReportSet(
SupportedReportSet::default(),
)),
} }
} }
@@ -176,6 +181,7 @@ impl Resource for CalendarFile {
CalendarProp::Getcontenttype(_) => Err(rustical_dav::Error::PropReadOnly), CalendarProp::Getcontenttype(_) => Err(rustical_dav::Error::PropReadOnly),
CalendarProp::MaxResourceSize(_) => Err(rustical_dav::Error::PropReadOnly), CalendarProp::MaxResourceSize(_) => Err(rustical_dav::Error::PropReadOnly),
CalendarProp::CurrentUserPrivilegeSet(_) => Err(rustical_dav::Error::PropReadOnly), CalendarProp::CurrentUserPrivilegeSet(_) => Err(rustical_dav::Error::PropReadOnly),
CalendarProp::SupportedReportSet(_) => Err(rustical_dav::Error::PropReadOnly),
CalendarProp::Invalid => Err(rustical_dav::Error::PropReadOnly), CalendarProp::Invalid => Err(rustical_dav::Error::PropReadOnly),
} }
} }
@@ -212,6 +218,7 @@ impl Resource for CalendarFile {
CalendarPropName::Getcontenttype => Err(rustical_dav::Error::PropReadOnly), CalendarPropName::Getcontenttype => Err(rustical_dav::Error::PropReadOnly),
CalendarPropName::MaxResourceSize => Err(rustical_dav::Error::PropReadOnly), CalendarPropName::MaxResourceSize => Err(rustical_dav::Error::PropReadOnly),
CalendarPropName::CurrentUserPrivilegeSet => Err(rustical_dav::Error::PropReadOnly), CalendarPropName::CurrentUserPrivilegeSet => Err(rustical_dav::Error::PropReadOnly),
CalendarPropName::SupportedReportSet => Err(rustical_dav::Error::PropReadOnly),
} }
} }
} }