diff --git a/src/pages/directory/edit.rs b/src/pages/directory/edit.rs index 5f6ac11..00f7b8f 100644 --- a/src/pages/directory/edit.rs +++ b/src/pages/directory/edit.rs @@ -24,7 +24,7 @@ use crate::{ stacked_badge::StackedBadge, stacked_input::StackedInput, tab::Tab, - Form, FormButtonBar, FormElement, FormItem, FormSection, + Form, FormButtonBar, FormElement, FormItem, FormSection, ValidateCb, }, messages::alert::{use_alerts, Alert}, skeleton::Skeleton, @@ -840,6 +840,30 @@ pub fn PrincipalEdit() -> impl IntoView { /> + + + + + @@ -1094,6 +1118,7 @@ impl FormData { principal.disabled_permissions.as_string_list(), ), ("urls", principal.urls.as_string_list()), + ("external-members", principal.external_members.as_string_list()), ] { self.array_set(key, list.iter()); } @@ -1156,6 +1181,7 @@ impl FormData { ("enabled-permissions", &mut principal.enabled_permissions), ("disabled-permissions", &mut principal.disabled_permissions), ("urls", &mut principal.urls), + ("external-members", &mut principal.external_members) ] { *list = PrincipalValue::StringList( self.array_value(key).map(|m| m.to_string()).collect(), @@ -1219,6 +1245,13 @@ impl Builder { [Validator::IsEmail], ) .build() + .new_field("external-members") + .typ(Type::Array) + .input_check( + [Transformer::Trim, Transformer::Lowercase], + [Validator::IsEmail], + ) + .build() .new_field("urls") .typ(Type::Array) .input_check([Transformer::Trim], [Validator::IsUrl]) diff --git a/src/pages/directory/mod.rs b/src/pages/directory/mod.rs index 58bb4a2..29cdc09 100644 --- a/src/pages/directory/mod.rs +++ b/src/pages/directory/mod.rs @@ -77,6 +77,10 @@ pub struct Principal { #[serde(default, skip_serializing_if = "PrincipalValue::is_none")] #[serde(rename = "disabledPermissions")] pub disabled_permissions: PrincipalValue, + + #[serde(default, skip_serializing_if = "PrincipalValue::is_none")] + #[serde(rename = "externalMembers")] + pub external_members: PrincipalValue, } #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] @@ -117,6 +121,7 @@ pub enum PrincipalField { DisabledPermissions, Picture, Urls, + ExternalMembers, } #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)] @@ -240,6 +245,11 @@ impl Principal { for (field, current, change) in [ (PrincipalField::Emails, current.emails, changes.emails), + ( + PrincipalField::ExternalMembers, + current.external_members, + changes.external_members, + ), ( PrincipalField::MemberOf, current.member_of,