[GH-ISSUE #464] Impossible to add a new simple user #448

Closed
opened 2026-02-27 11:11:50 +03:00 by kerem · 3 comments
Owner

Originally created by @tonioo on GitHub (Dec 4, 2013).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/464

Originally assigned to: @tonioo on GitHub.

Originally created by Anthony Bourguignon on 2013-10-09T13:39:34Z

Hi,

It seems impossible for a domain admin to add a simple user if quota is set 0. I'm using Modoboa 1.0.1 with a postgresql database.

Here what I've done : I've created a new domain as a Super Admin. As the quota field must be set, I choose 0 (I don't want to enable quota). I gave the domain admin to another user. When he tried to add a simple user, he wasn't able to do so. If he leaves the checkbox activated to use the domain's value, he has the error "A quota is required". It's the same if he leaves it empty without the checkbox activated. If he tries to put a value, the error is "Quota is greater than the allowed domain's limit" (that part seems normal). It's impossible for him to add a user.

I think that the issue came from the file /srv/www/toniob.net/admin.mail/lib/python2.7/site-packages/modoboa/admin/models.py , in the function set_quota. The condition "if not self.quota and not override_rules" is True if quota is set to 0 (which is the case here) and the user is not a super admin.

Did I do something wrong ? I can make more tests if you need to.

Thanks

Originally created by @tonioo on GitHub (Dec 4, 2013). Original GitHub issue: https://github.com/modoboa/modoboa/issues/464 Originally assigned to: @tonioo on GitHub. **Originally created by Anthony Bourguignon on 2013-10-09T13:39:34Z** Hi, It seems impossible for a domain admin to add a simple user if quota is set 0. I'm using Modoboa 1.0.1 with a postgresql database. Here what I've done : I've created a new domain as a Super Admin. As the quota field must be set, I choose 0 (I don't want to enable quota). I gave the domain admin to another user. When he tried to add a simple user, he wasn't able to do so. If he leaves the checkbox activated to use the domain's value, he has the error "A quota is required". It's the same if he leaves it empty without the checkbox activated. If he tries to put a value, the error is "Quota is greater than the allowed domain's limit" (that part seems normal). It's impossible for him to add a user. I think that the issue came from the file /srv/www/toniob.net/admin.mail/lib/python2.7/site-packages/modoboa/admin/models.py , in the function set_quota. The condition "if not self.quota and not override_rules" is True if quota is set to 0 (which is the case here) and the user is not a super admin. Did I do something wrong ? I can make more tests if you need to. Thanks
kerem 2026-02-27 11:11:50 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@tonioo commented on GitHub (Dec 4, 2013):

Posted by Antoine Nguyen on 2013-10-09T14:13:31Z

Hi Anthony,

it seems you found a true issue! The condition you pointed out is indeed responsible of the message you see.

Could you please try the following modification ?

diff --git a/modoboa/admin/models.py b/modoboa/admin/models.py
index a822754..546182d 100644
--- a/modoboa/admin/models.py
+++ b/modoboa/admin/models.py
@@ -922,7 +922,7 @@ class Mailbox(DatesAware):
             )
         else:
             self.quota = value
-        if not self.quota and not override_rules:
+        if not self.quota and self.domain.quota and not override_rules:
             raise AdminError(_("A quota is required"))
 
     def get_quota(self):
<!-- gh-comment-id:29816759 --> @tonioo commented on GitHub (Dec 4, 2013): **Posted by Antoine Nguyen on 2013-10-09T14:13:31Z** Hi Anthony, it seems you found a true issue! The condition you pointed out is indeed responsible of the message you see. Could you please try the following modification ? <pre> diff --git a/modoboa/admin/models.py b/modoboa/admin/models.py index a822754..546182d 100644 --- a/modoboa/admin/models.py +++ b/modoboa/admin/models.py @@ -922,7 +922,7 @@ class Mailbox(DatesAware): ) else: self.quota = value - if not self.quota and not override_rules: + if not self.quota and self.domain.quota and not override_rules: raise AdminError(_("A quota is required")) def get_quota(self): </pre>
Author
Owner

@tonioo commented on GitHub (Dec 4, 2013):

Posted by Anthony Bourguignon on 2013-10-09T16:02:18Z

It's working as expected now. The creation and the update too. Thanks a lot.

<!-- gh-comment-id:29816760 --> @tonioo commented on GitHub (Dec 4, 2013): **Posted by Anthony Bourguignon on 2013-10-09T16:02:18Z** It's working as expected now. The creation and the update too. Thanks a lot.
Author
Owner

@tonioo commented on GitHub (Dec 4, 2013):

Posted by Antoine Nguyen on 2013-10-12T18:23:33Z

Applied in changeset commit:f148eb2968d161dd51c1c5dd6b5e0e4387f79669.

<!-- gh-comment-id:29816762 --> @tonioo commented on GitHub (Dec 4, 2013): **Posted by Antoine Nguyen on 2013-10-12T18:23:33Z** Applied in changeset commit:f148eb2968d161dd51c1c5dd6b5e0e4387f79669.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#448
No description provided.