tenant gate active

This commit is contained in:
2025-11-11 02:45:05 +01:00
parent ac9e688e7a
commit 4f29ff73c6
12 changed files with 168 additions and 123 deletions
+9 -1
View File
@@ -16,7 +16,10 @@ use quick_xml::events::{BytesDecl, BytesEnd, BytesStart, BytesText, Event};
use quick_xml::Writer;
use uuid::Uuid;
use crate::auth::api_tokens::{find_active_token_by_secret, touch_api_token};
use crate::auth::{
api_tokens::{find_active_token_by_secret, touch_api_token},
ensure_active_tenant,
};
use crate::error::{AppError, AppResult};
use crate::models::{ApiCapability, Document, DocumentVersion, Folder, User};
use crate::schema::{
@@ -483,6 +486,11 @@ fn authenticate(state: &AppState, headers: &HeaderMap) -> Result<Option<WebDavCo
}
};
if let Err(err) = ensure_active_tenant(state, tenant_id) {
tracing::warn!(tenant_id = %tenant_id, error = ?err, "webdav tenant not active");
return Ok(None);
}
apply_tenant_guc(&mut conn, tenant_id)?;
touch_api_token(&mut conn, token.id)?;