Add principal memberships to allow group accounts

This commit is contained in:
Lennart
2025-02-02 11:58:58 +01:00
parent 031d94c9d1
commit ccae96bb17
3 changed files with 26 additions and 4 deletions

View File

@@ -77,16 +77,23 @@ impl Resource for PrincipalResource {
prop: &PrincipalPropWrapperName,
) -> Result<Self::Prop, Self::Error> {
let principal_url = Self::get_url(rmap, vec![&self.principal]).unwrap();
let home_set = CalendarHomeSet(
self.home_set
.iter()
.map(|&(home_name, _read_only)| format!("{}/{}", principal_url, home_name).into())
user.memberships()
.into_iter()
.map(|principal| Self::get_url(rmap, vec![principal]).unwrap())
.flat_map(|principal_url| {
self.home_set.iter().map(move |&(home_name, _read_only)| {
HrefElement::new(format!("{}/{}", &principal_url, home_name))
})
})
.collect(),
);
Ok(match prop {
PrincipalPropWrapperName::Principal(prop) => {
PrincipalPropWrapper::Principal(match prop {
// TODO: principal types
PrincipalPropName::CalendarUserType => {
PrincipalProp::CalendarUserType("INDIVIDUAL")
}