Refactoring to move authentication out of the ResourceService layer

This commit is contained in:
Lennart
2024-09-29 15:01:46 +02:00
parent f2f66c95d2
commit 3469252cd3
8 changed files with 29 additions and 52 deletions

View File

@@ -54,11 +54,10 @@ pub async fn route_propfind<A: CheckAuthentication, R: ResourceService>(
R::Error,
> {
debug!("{body}");
let auth_info = auth.inner;
let prefix = prefix.into_inner();
let path = req.path().to_owned();
let resource_service = R::new(&req, &auth_info, path_components.into_inner()).await?;
let resource_service = R::new(&req, path_components.into_inner()).await?;
// A request body is optional. If empty we MUST return all props
let propfind: PropfindElement = if !body.is_empty() {
@@ -83,12 +82,12 @@ pub async fn route_propfind<A: CheckAuthentication, R: ResourceService>(
let mut member_responses = Vec::new();
if depth != Depth::Zero {
for (path, member) in resource_service.get_members(auth_info).await? {
for (path, member) in resource_service.get_members().await? {
member_responses.push(member.propfind(&prefix, path, props.clone()).await?);
}
}
let resource = resource_service.get_resource().await?;
let resource = resource_service.get_resource(auth.inner.user_id).await?;
let response = resource.propfind(&prefix, path, props).await?;
Ok(MultistatusElement {