From 190a2e32e963640365298cf449a3b12e91a1241b Mon Sep 17 00:00:00 2001 From: Edouard Vanbelle Date: Fri, 17 Jul 2026 20:34:01 +0200 Subject: [PATCH] refactor: apply rust formatter suggestion --- .../services/drive_management_service.rs | 5 +++++ src/common/di.rs | 3 ++- src/interfaces/api/handlers/admin_handler.rs | 20 +------------------ 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/src/application/services/drive_management_service.rs b/src/application/services/drive_management_service.rs index 91e90e27..d4e12779 100644 --- a/src/application/services/drive_management_service.rs +++ b/src/application/services/drive_management_service.rs @@ -480,6 +480,11 @@ impl DriveManagementService { /// supplied is overwritten. Returns the post-merge typed view. /// Audit emits `drive.policy_changed` with the post-merge bag for /// steady-state observability. + /// + /// Ed's call, 2026-07-17: intentional deviation from the AGENTS.md + /// "AuthZ in service layer" rule for this specific endpoint — + /// the handler-layer admin check stays, this method stays trusting. + /// See memory `feedback_drive_policies_admin_at_handler`. pub async fn update_policies( &self, caller_id: Uuid, diff --git a/src/common/di.rs b/src/common/di.rs index c905304a..9c433377 100644 --- a/src/common/di.rs +++ b/src/common/di.rs @@ -1074,7 +1074,8 @@ impl AppServiceFactory { user_repository, ) .with_drive_repo( - drive_repo as Arc, + drive_repo + as Arc, ), ); // Keep cached storage usage fresh off the request path: GET /api/auth/me diff --git a/src/interfaces/api/handlers/admin_handler.rs b/src/interfaces/api/handlers/admin_handler.rs index cf81f53d..031cef5b 100644 --- a/src/interfaces/api/handlers/admin_handler.rs +++ b/src/interfaces/api/handlers/admin_handler.rs @@ -151,7 +151,6 @@ pub fn admin_routes() -> Router> { pub async fn get_oidc_settings( State(state): State>, ) -> Result { - let svc = state .admin_settings_service .as_ref() @@ -206,7 +205,6 @@ async fn test_oidc_connection( State(state): State>, Json(dto): Json, ) -> Result { - let svc = state .admin_settings_service .as_ref() @@ -239,7 +237,6 @@ async fn test_oidc_connection( pub async fn get_storage_settings( State(state): State>, ) -> Result { - let svc = state .storage_settings_service .as_ref() @@ -294,7 +291,6 @@ async fn test_storage_connection( State(state): State>, Json(dto): Json, ) -> Result { - let svc = state .storage_settings_service .as_ref() @@ -350,7 +346,6 @@ pub async fn start_migration( ) -> Result { use crate::infrastructure::services::migration_blob_backend::MigrationStatus; - // Check not already running. { let s = state.migration_state.read().await; @@ -521,7 +516,6 @@ pub async fn verify_migration( State(state): State>, Json(dto): Json, ) -> Result { - let pool = state .db_pool .clone() @@ -652,7 +646,6 @@ fn build_backend_from_config( pub async fn get_dashboard_stats( State(state): State>, ) -> Result { - let auth = state .auth_service .as_ref() @@ -742,7 +735,6 @@ pub async fn list_users( State(state): State>, Query(query): Query, ) -> Result { - let auth = state .auth_service .as_ref() @@ -789,7 +781,6 @@ pub async fn get_user( State(state): State>, Path(id): Path, ) -> Result { - let id = Uuid::parse_str(&id).map_err(|_| AppError::bad_request("Invalid UUID"))?; let auth = state @@ -981,7 +972,6 @@ pub async fn update_user_quota( Path(id): Path, Json(dto): Json, ) -> Result { - let id = Uuid::parse_str(&id).map_err(|_| AppError::bad_request("Invalid UUID"))?; let auth = state @@ -1024,7 +1014,6 @@ pub async fn create_user( State(state): State>, Json(dto): Json, ) -> Result { - let auth = state .auth_service .as_ref() @@ -1064,7 +1053,6 @@ pub async fn reset_user_password( Path(id): Path, Json(dto): Json, ) -> Result { - let id = Uuid::parse_str(&id).map_err(|_| AppError::bad_request("Invalid UUID"))?; let auth = state @@ -1147,7 +1135,6 @@ pub async fn set_registration_setting( async fn reextract_audio_metadata( State(state): State>, ) -> Result { - let audio_service = state .applications .audio_metadata_service @@ -1175,7 +1162,6 @@ async fn reextract_audio_metadata( async fn reextract_image_metadata( State(state): State>, ) -> Result { - let result = state .applications .media_metadata_service @@ -1218,10 +1204,7 @@ async fn reextract_image_metadata( security(("bearerAuth" = [])), tag = "admin" )] -async fn get_smtp_info( - State(state): State>, -) -> Result { - +async fn get_smtp_info(State(state): State>) -> Result { let smtp = &state.core.config.smtp; let info = SmtpInfoDto { enabled: smtp.is_enabled() && state.email_sender.is_some(), @@ -1252,7 +1235,6 @@ async fn get_captured_email( State(state): State>, Query(params): Query, ) -> Result { - if !std::env::var("OXICLOUD_SMTP_MOCK") .map(|v| v == "true" || v == "1") .unwrap_or(false)