mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 15:52:27 +00:00
Work on axum support
This commit is contained in:
@@ -6,11 +6,11 @@ use crate::{
|
||||
};
|
||||
use actix_web::{
|
||||
HttpRequest, Responder,
|
||||
http::StatusCode,
|
||||
web::{Data, Path},
|
||||
};
|
||||
use calendar_multiget::{CalendarMultigetRequest, get_objects_calendar_multiget};
|
||||
use calendar_query::{CalendarQueryRequest, get_objects_calendar_query};
|
||||
use http::StatusCode;
|
||||
use rustical_dav::{
|
||||
resource::{PrincipalUri, Resource},
|
||||
xml::{
|
||||
|
||||
@@ -4,7 +4,7 @@ use crate::{
|
||||
CalendarObjectPropWrapper, CalendarObjectPropWrapperName, CalendarObjectResource,
|
||||
},
|
||||
};
|
||||
use actix_web::http::StatusCode;
|
||||
use http::StatusCode;
|
||||
use rustical_dav::{
|
||||
resource::{PrincipalUri, Resource},
|
||||
xml::{
|
||||
|
||||
@@ -322,7 +322,7 @@ impl<C: CalendarStore, S: SubscriptionStore> CalendarResourceService<C, S> {
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait(?Send)]
|
||||
#[async_trait]
|
||||
impl<C: CalendarStore, S: SubscriptionStore> ResourceService for CalendarResourceService<C, S> {
|
||||
type MemberType = CalendarObjectResource;
|
||||
type PathComponents = (String, String); // principal, calendar_id
|
||||
@@ -331,6 +331,8 @@ impl<C: CalendarStore, S: SubscriptionStore> ResourceService for CalendarResourc
|
||||
type Principal = User;
|
||||
type PrincipalUri = CalDavPrincipalUri;
|
||||
|
||||
const DAV_HEADER: &str = "1, 3, access-control, calendar-access";
|
||||
|
||||
async fn get_resource(
|
||||
&self,
|
||||
(principal, cal_id): &Self::PathComponents,
|
||||
|
||||
@@ -137,7 +137,7 @@ pub struct CalendarObjectPathComponents {
|
||||
pub object_id: String,
|
||||
}
|
||||
|
||||
#[async_trait(?Send)]
|
||||
#[async_trait]
|
||||
impl<C: CalendarStore> ResourceService for CalendarObjectResourceService<C> {
|
||||
type PathComponents = CalendarObjectPathComponents;
|
||||
type Resource = CalendarObjectResource;
|
||||
@@ -146,6 +146,8 @@ impl<C: CalendarStore> ResourceService for CalendarObjectResourceService<C> {
|
||||
type Principal = User;
|
||||
type PrincipalUri = CalDavPrincipalUri;
|
||||
|
||||
const DAV_HEADER: &str = "1, 3, access-control, calendar-access";
|
||||
|
||||
async fn get_resource(
|
||||
&self,
|
||||
CalendarObjectPathComponents {
|
||||
|
||||
@@ -77,7 +77,7 @@ impl<C: CalendarStore, S: SubscriptionStore> CalendarSetResourceService<C, S> {
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait(?Send)]
|
||||
#[async_trait]
|
||||
impl<C: CalendarStore, S: SubscriptionStore> ResourceService for CalendarSetResourceService<C, S> {
|
||||
type PathComponents = (String,);
|
||||
type MemberType = CalendarResource;
|
||||
@@ -86,6 +86,8 @@ impl<C: CalendarStore, S: SubscriptionStore> ResourceService for CalendarSetReso
|
||||
type Principal = User;
|
||||
type PrincipalUri = CalDavPrincipalUri;
|
||||
|
||||
const DAV_HEADER: &str = "1, 3, access-control, extended-mkcol";
|
||||
|
||||
async fn get_resource(
|
||||
&self,
|
||||
(principal,): &Self::PathComponents,
|
||||
|
||||
@@ -71,7 +71,8 @@ impl actix_web::ResponseError for Error {
|
||||
_ => StatusCode::INTERNAL_SERVER_ERROR,
|
||||
},
|
||||
Error::ChronoParseError(_) => StatusCode::INTERNAL_SERVER_ERROR,
|
||||
Error::DavError(err) => err.status_code(),
|
||||
Error::DavError(err) => StatusCode::try_from(err.status_code().as_u16())
|
||||
.expect("Just converting between versions"),
|
||||
Error::Unauthorized => StatusCode::UNAUTHORIZED,
|
||||
Error::XmlDecodeError(_) => StatusCode::BAD_REQUEST,
|
||||
Error::NotImplemented => StatusCode::INTERNAL_SERVER_ERROR,
|
||||
|
||||
@@ -145,7 +145,7 @@ impl<AP: AuthenticationProvider, S: SubscriptionStore, CS: CalendarStore, BS: Ca
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait(?Send)]
|
||||
#[async_trait]
|
||||
impl<AP: AuthenticationProvider, S: SubscriptionStore, CS: CalendarStore, BS: CalendarStore>
|
||||
ResourceService for PrincipalResourceService<AP, S, CS, BS>
|
||||
{
|
||||
@@ -156,6 +156,8 @@ impl<AP: AuthenticationProvider, S: SubscriptionStore, CS: CalendarStore, BS: Ca
|
||||
type Principal = User;
|
||||
type PrincipalUri = CalDavPrincipalUri;
|
||||
|
||||
const DAV_HEADER: &str = "1, 3, access-control";
|
||||
|
||||
async fn get_resource(
|
||||
&self,
|
||||
(principal,): &Self::PathComponents,
|
||||
|
||||
Reference in New Issue
Block a user