mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 22:52:22 +00:00
Implement supported-report-set property for calendar collection
This commit is contained in:
@@ -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(),
|
||||
],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ use tokio::sync::RwLock;
|
||||
|
||||
use super::prop::{
|
||||
Resourcetype, SupportedCalendarComponent, SupportedCalendarComponentSet, SupportedCalendarData,
|
||||
UserPrivilegeSet,
|
||||
SupportedReportSet, UserPrivilegeSet,
|
||||
};
|
||||
|
||||
pub struct CalendarResource<C: CalendarStore + ?Sized> {
|
||||
@@ -41,6 +41,7 @@ pub enum CalendarPropName {
|
||||
Getcontenttype,
|
||||
CurrentUserPrivilegeSet,
|
||||
MaxResourceSize,
|
||||
SupportedReportSet,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
@@ -71,6 +72,7 @@ pub enum CalendarProp {
|
||||
Getcontenttype(String),
|
||||
MaxResourceSize(String),
|
||||
CurrentUserPrivilegeSet(UserPrivilegeSet),
|
||||
SupportedReportSet(SupportedReportSet),
|
||||
#[serde(other)]
|
||||
Invalid,
|
||||
}
|
||||
@@ -138,6 +140,9 @@ impl Resource for CalendarFile {
|
||||
CalendarPropName::CurrentUserPrivilegeSet => Ok(CalendarProp::CurrentUserPrivilegeSet(
|
||||
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::MaxResourceSize(_) => 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),
|
||||
}
|
||||
}
|
||||
@@ -212,6 +218,7 @@ impl Resource for CalendarFile {
|
||||
CalendarPropName::Getcontenttype => Err(rustical_dav::Error::PropReadOnly),
|
||||
CalendarPropName::MaxResourceSize => Err(rustical_dav::Error::PropReadOnly),
|
||||
CalendarPropName::CurrentUserPrivilegeSet => Err(rustical_dav::Error::PropReadOnly),
|
||||
CalendarPropName::SupportedReportSet => Err(rustical_dav::Error::PropReadOnly),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user