Don't allow mailbox quota values greater than the domain's one.

fix #401
This commit is contained in:
Antoine Nguyen
2013-04-23 20:38:12 +02:00
parent 0996c6e9ed
commit c9d3e0868b
+5 -1
View File
@@ -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