Registry caching and directory synchronization

This commit is contained in:
mdecimus
2026-02-20 19:36:03 +01:00
parent 2a557c58e5
commit ddf9cc7ba7
80 changed files with 2238 additions and 467 deletions

View File

@@ -111,7 +111,11 @@ impl<T: SessionStream> Session<T> {
.and_then(|access_token| access_token.assert_has_permission(Permission::EmailSend));
let result = match result {
Ok(access_token) => self.server.account_info(access_token.account_id()).await,
Ok(access_token) => {
self.server
.account_info(access_token.account_id())
.await
}
Err(err) => Err(err),
};
@@ -198,7 +202,7 @@ impl<T: SessionStream> Session<T> {
self.data.authenticated_as.is_some()
}
pub fn authenticated_emails(&self) -> impl Iterator<Item = &str> {
pub fn authenticated_emails(&self) -> &[String] {
self.data.authenticated_as.as_ref().unwrap().addresses()
}
}

View File

@@ -245,7 +245,10 @@ impl<T: SessionStream> Session<T> {
{
let address_lcase = self.data.mail_from.as_ref().unwrap().address_lcase.as_str();
if authenticated_as != address_lcase
&& !self.authenticated_emails().any(|e| e == address_lcase)
&& !self
.authenticated_emails()
.iter()
.any(|e| e == address_lcase)
{
trc::event!(
Smtp(SmtpEvent::MailFromUnauthorized),
@@ -255,6 +258,7 @@ impl<T: SessionStream> Session<T> {
.into_iter()
.chain(
self.authenticated_emails()
.iter()
.map(|e| trc::Value::String(e.into()))
)
.collect::<Vec<_>>()