Fix tenant quota update API

This commit is contained in:
mdecimus 2025-07-20 15:51:27 +02:00
parent 08980ac72e
commit 0dcaadb668

View file

@ -394,13 +394,15 @@ impl ManageDirectory for Store {
let mut principal_quotas = Vec::new();
for (idx, quota) in quotas.into_iter().take(Type::MAX_ID + 2).enumerate() {
if idx != 0 {
principal_quotas.push(PrincipalQuota {
quota,
typ: Type::from_u8((idx - 1) as u8),
});
} else if quota != 0 {
principal_create.quota = Some(quota);
if quota != 0 {
if idx != 0 {
principal_quotas.push(PrincipalQuota {
quota,
typ: Type::from_u8((idx - 1) as u8),
});
} else {
principal_create.quota = Some(quota);
}
}
}
@ -1209,13 +1211,15 @@ impl ManageDirectory for Store {
let mut principal_quotas = Vec::new();
for (idx, quota) in quotas.into_iter().enumerate() {
if idx != 0 {
principal_quotas.push(PrincipalQuota {
quota,
typ: Type::from_u8((idx - 1) as u8),
});
} else if quota != 0 {
new_quota = Some(quota);
if quota != 0 {
if idx != 0 {
principal_quotas.push(PrincipalQuota {
quota,
typ: Type::from_u8((idx - 1) as u8),
});
} else {
new_quota = Some(quota);
}
}
}