dav: Make owner field optional again

This commit is contained in:
Lennart
2024-12-25 17:42:39 +01:00
parent 2eac441bad
commit b9edc295a8

View File

@@ -40,7 +40,7 @@ pub enum CommonPropertiesProp {
// WebDAV Access Control Protocol (RFC 3477) // WebDAV Access Control Protocol (RFC 3477)
CurrentUserPrivilegeSet(UserPrivilegeSet), CurrentUserPrivilegeSet(UserPrivilegeSet),
Owner(HrefElement), Owner(Option<HrefElement>),
} }
#[derive(Serialize)] #[derive(Serialize)]
@@ -93,18 +93,11 @@ pub trait Resource: Clone + 'static {
CommonPropertiesProp::CurrentUserPrivilegeSet(self.get_user_privileges(user)?) CommonPropertiesProp::CurrentUserPrivilegeSet(self.get_user_privileges(user)?)
} }
CommonPropertiesPropName::Owner => { CommonPropertiesPropName::Owner => {
// TODO: Reintroduce optional owner field CommonPropertiesProp::Owner(self.get_owner().map(|owner| {
let owner = self.get_owner().unwrap_or(&user.id);
CommonPropertiesProp::Owner(
Self::PrincipalResource::get_url(rmap, [owner]) Self::PrincipalResource::get_url(rmap, [owner])
.unwrap() .unwrap()
.into(), .into()
) }))
// CommonPropertiesProp::Owner(self.get_owner().map(|owner| {
// Self::PrincipalResource::get_url(rmap, [owner])
// .unwrap()
// .into()
// }))
} }
}) })
} }