From c9d3e0868b87cfca55e25722d2a587108d3f3bba Mon Sep 17 00:00:00 2001 From: Antoine Nguyen Date: Tue, 23 Apr 2013 20:38:12 +0200 Subject: [PATCH] Don't allow mailbox quota values greater than the domain's one. fix #401 --- modoboa/admin/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modoboa/admin/models.py b/modoboa/admin/models.py index 50ecfdef6..92aadc4d6 100644 --- a/modoboa/admin/models.py +++ b/modoboa/admin/models.py @@ -719,8 +719,12 @@ class Mailbox(DatesAware): raise AdminError(_("Failed to remove mailbox: %s" % output)) def set_quota(self, value, override_domain=False): - if value is None or (int(value) > self.domain.quota and not override_domain): + if value is None: self.quota = self.domain.quota + elif int(value) > self.domain.quota and not override_domain: + raise AdminError( + _("Quota is greater than the allowed domain's limit (%dM)" % self.domain.quota) + ) else: self.quota = value