From 5cf0266d247f06ffcf74a80450ba142e8ad92eea Mon Sep 17 00:00:00 2001 From: BillionClaw <267901332+BillionClaw@users.noreply.github.com> Date: Wed, 18 Mar 2026 11:06:39 +0800 Subject: [PATCH] fix(auth): cap admin initial quota to available disk space The admin_create_user method was using hardcoded quota values (100GB for admin, 1GB for user) instead of the capped_quota method that checks available disk space. This could result in setting a quota higher than the actual available disk space. Fixes #92 --- src/application/services/auth_application_service.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/application/services/auth_application_service.rs b/src/application/services/auth_application_service.rs index 6b888e06..0b82bb72 100755 --- a/src/application/services/auth_application_service.rs +++ b/src/application/services/auth_application_service.rs @@ -736,14 +736,8 @@ impl AuthApplicationService { _ => UserRole::User, }; - // Determine quota - let quota = dto.quota_bytes.unwrap_or_else(|| { - if role == UserRole::Admin { - 107_374_182_400 - } else { - 1_073_741_824 - } - }); + // Determine quota, capped to available disk space + let quota = dto.quota_bytes.unwrap_or_else(|| self.capped_quota(&role)); // Hash password let password_hash = self.password_hasher.hash_password(&dto.password).await?;