Delete user from lldap on cleanup

This commit is contained in:
2025-03-18 01:22:20 +01:00
parent 87a4749471
commit e858baaa3c
3 changed files with 60 additions and 5 deletions

View File

@@ -39,6 +39,10 @@ pub trait ControllerEvents {
async fn user_created<T>(&self, obj: &T, username: &str) -> Result<(), Self::Error>
where
T: Resource<DynamicType = ()> + Sync;
async fn user_deleted<T>(&self, obj: &T, username: &str) -> Result<(), Self::Error>
where
T: Resource<DynamicType = ()> + Sync;
}
#[async_trait]
@@ -78,4 +82,21 @@ impl ControllerEvents for Recorder {
)
.await
}
async fn user_deleted<T>(&self, obj: &T, username: &str) -> Result<(), Self::Error>
where
T: Resource<DynamicType = ()> + Sync,
{
self.publish(
&Event {
type_: EventType::Normal,
reason: "UserDeleted".into(),
note: Some(format!("Deleted user '{username}'")),
action: "UserDeleted".into(),
secondary: None,
},
&obj.object_ref(&()),
)
.await
}
}