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
This commit is contained in:
@@ -736,14 +736,8 @@ impl AuthApplicationService {
|
|||||||
_ => UserRole::User,
|
_ => UserRole::User,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Determine quota
|
// Determine quota, capped to available disk space
|
||||||
let quota = dto.quota_bytes.unwrap_or_else(|| {
|
let quota = dto.quota_bytes.unwrap_or_else(|| self.capped_quota(&role));
|
||||||
if role == UserRole::Admin {
|
|
||||||
107_374_182_400
|
|
||||||
} else {
|
|
||||||
1_073_741_824
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Hash password
|
// Hash password
|
||||||
let password_hash = self.password_hasher.hash_password(&dto.password).await?;
|
let password_hash = self.password_hasher.hash_password(&dto.password).await?;
|
||||||
|
|||||||
Reference in New Issue
Block a user