Include OAuth public endpoint in PACC responses

This commit is contained in:
Maurus Decimus
2026-04-19 14:35:06 +02:00
parent 47d21dd03d
commit eaf0601742
22 changed files with 791 additions and 2630 deletions

View File

@@ -359,38 +359,45 @@ async fn store_maintenance(
}
}
TaskStoreMaintenanceType::ResetTenantQuotas => {
let mut batch = BatchBuilder::new();
let now = now() as i64;
for tenant_id in server
.registry()
.query::<RoaringBitmap>(RegistryQuery::new(ObjectType::Tenant))
.await?
// SPDX-SnippetBegin
// SPDX-FileCopyrightText: 2020 Stalwart Labs LLC <hello@stalw.art>
// SPDX-License-Identifier: LicenseRef-SEL
#[cfg(feature = "enterprise")]
{
#[cfg(feature = "test_mode")]
let status = TaskStatus::at(now);
let mut batch = BatchBuilder::new();
let now = now() as i64;
#[cfg(not(feature = "test_mode"))]
let status =
TaskStatus::at(now + rand::Rng::random_range(&mut rand::rng(), 0..=300));
for tenant_id in server
.registry()
.query::<RoaringBitmap>(RegistryQuery::new(ObjectType::Tenant))
.await?
{
#[cfg(feature = "test_mode")]
let status = TaskStatus::at(now);
batch.schedule_task(Task::TenantMaintenance(TaskTenantMaintenance {
tenant_id: tenant_id.into(),
maintenance_type: TaskTenantMaintenanceType::RecalculateQuota,
status,
}));
#[cfg(not(feature = "test_mode"))]
let status =
TaskStatus::at(now + rand::Rng::random_range(&mut rand::rng(), 0..=300));
if batch.is_large_batch() {
batch.schedule_task(Task::TenantMaintenance(TaskTenantMaintenance {
tenant_id: tenant_id.into(),
maintenance_type: TaskTenantMaintenanceType::RecalculateQuota,
status,
}));
if batch.is_large_batch() {
server.core.storage.data.write(batch.build_all()).await?;
server.notify_task_queue();
batch = BatchBuilder::new();
}
}
if !batch.is_empty() {
server.core.storage.data.write(batch.build_all()).await?;
server.notify_task_queue();
batch = BatchBuilder::new();
}
}
if !batch.is_empty() {
server.core.storage.data.write(batch.build_all()).await?;
server.notify_task_queue();
}
// SPDX-SnippetEnd
}
}
@@ -489,6 +496,10 @@ async fn recalculate_quota(server: &Server, account_id: u32) -> trc::Result<()>
.map(|_| ())
}
// SPDX-SnippetBegin
// SPDX-FileCopyrightText: 2020 Stalwart Labs LLC <hello@stalw.art>
// SPDX-License-Identifier: LicenseRef-SEL
#[cfg(feature = "enterprise")]
async fn recalculate_tenant_quota(server: &Server, tenant_id: u32) -> trc::Result<()> {
let mut quota = 0;
for account_id in server
@@ -515,6 +526,12 @@ async fn recalculate_tenant_quota(server: &Server, tenant_id: u32) -> trc::Resul
.caused_by(trc::location!())
.map(|_| ())
}
// SPDX-SnippetEnd
#[cfg(not(feature = "enterprise"))]
async fn recalculate_tenant_quota(_server: &Server, _tenant_id: u32) -> trc::Result<()> {
Ok(())
}
async fn reset_imap_uids(server: &Server, account_id: u32) -> trc::Result<(u32, u32)> {
let mut mailbox_count = 0;