From ede01a92c298c8adadb4e0629025c91196a126b9 Mon Sep 17 00:00:00 2001 From: mdecimus Date: Sun, 20 Jul 2025 16:10:46 +0200 Subject: [PATCH] Invalidate logo cache when changes are made (fixes #1856) --- crates/directory/src/core/principal.rs | 2 +- crates/http/src/management/principal.rs | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/crates/directory/src/core/principal.rs b/crates/directory/src/core/principal.rs index d1e5ea71..a3d75f6e 100644 --- a/crates/directory/src/core/principal.rs +++ b/crates/directory/src/core/principal.rs @@ -912,7 +912,7 @@ impl Type { 1 => Type::Group, 2 => Type::Resource, 3 => Type::Location, - 4 => Type::Individual, // legacy + 4 => Type::Other, // legacy 5 => Type::List, 6 => Type::Other, 7 => Type::Domain, diff --git a/crates/http/src/management/principal.rs b/crates/http/src/management/principal.rs index be2f3d5e..eae36e3d 100644 --- a/crates/http/src/management/principal.rs +++ b/crates/http/src/management/principal.rs @@ -572,6 +572,7 @@ impl PrincipalManager for Server { })?; // Validate changes + let mut invalidate_logo_cache = false; for change in &changes { match change.field { PrincipalField::Secrets @@ -581,13 +582,16 @@ impl PrincipalManager for Server { | PrincipalField::UsedQuota | PrincipalField::Description | PrincipalField::Type - | PrincipalField::Picture | PrincipalField::MemberOf | PrincipalField::Members | PrincipalField::Lists | PrincipalField::Urls | PrincipalField::ExternalMembers | PrincipalField::Locale => (), + PrincipalField::Picture => { + invalidate_logo_cache |= + matches!(typ, Type::Domain | Type::Tenant); + } PrincipalField::Tenant => { // Tenants are not allowed to change their tenantId if access_token.tenant.is_some() { @@ -671,6 +675,11 @@ impl PrincipalManager for Server { // Increment revision self.invalidate_principal_caches(changed_principals).await; + // Invalidate logo cache if needed + if invalidate_logo_cache { + self.inner.data.logos.lock().clear(); + } + Ok(JsonResponse::new(json!({ "data": (), }))