diff --git a/CHANGELOG.md b/CHANGELOG.md index 344fe29a..07b5b164 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -75,6 +75,7 @@ v1.6.0 - unreleased - Enhancement: Contribution documentation ([#700](https://github.com/Mailu/Mailu/issues/700)) - Enhancement: Move Mailu Docker network to a fixed subnet ([#727](https://github.com/Mailu/Mailu/issues/727)) - Enhancement: Added regex validation for alias username ([#764](https://github.com/Mailu/Mailu/issues/764)) +- Enhancement: Allow to disable aliases or users for a specific domain ([#799](https://github.com/Mailu/Mailu/issues/799)) - Enhancement: Update documentation - Enhancement: Include favicon package ([#801](https://github.com/Mailu/Mailu/issues/801), ([#802](https://github.com/Mailu/Mailu/issues/802)) - Enhancement: Add logging at critical places in python start.py scripts. Implement LOG_LEVEL to control verbosity ([#588](https://github.com/Mailu/Mailu/issues/588)) @@ -111,6 +112,7 @@ v1.6.0 - unreleased - Bug: Error when trying to log in with an account without domain ([#585](https://github.com/Mailu/Mailu/issues/585)) - Bug: Fix rainloop permissions ([#637](https://github.com/Mailu/Mailu/issues/637)) - Bug: Fix broken webmail and logo url in admin ([#792](https://github.com/Mailu/Mailu/issues/792)) +- Bug: Don't allow negative values on domain creation/edit ([#799](https://github.com/Mailu/Mailu/issues/799)) - Bug: Don't recursivly chown on mailboxes ([#776](https://github.com/Mailu/Mailu/issues/776)) - Bug: Fix forced password input for user edit ([#745](https://github.com/Mailu/Mailu/issues/745)) - Bug: Fetched accounts: Password field is of type "text" ([#789](https://github.com/Mailu/Mailu/issues/789)) diff --git a/core/admin/mailu/manage.py b/core/admin/mailu/manage.py index 7f32f6c8..4846c2d6 100644 --- a/core/admin/mailu/manage.py +++ b/core/admin/mailu/manage.py @@ -91,7 +91,7 @@ def user(localpart, domain_name, password, hash_scheme=None): @click.option('-a', '--max_aliases') @click.option('-q', '--max_quota_bytes') @flask_cli.with_appcontext -def domain(domain_name, max_users=0, max_aliases=0, max_quota_bytes=0): +def domain(domain_name, max_users=-1, max_aliases=-1, max_quota_bytes=0): domain = models.Domain.query.get(domain_name) if not domain: domain = models.Domain(name=domain_name) @@ -140,8 +140,8 @@ def config_update(verbose=False, delete_objects=False): if verbose: print(str(domain_config)) domain_name = domain_config['name'] - max_users = domain_config.get('max_users', 0) - max_aliases = domain_config.get('max_aliases', 0) + max_users = domain_config.get('max_users', -1) + max_aliases = domain_config.get('max_aliases', -1) max_quota_bytes = domain_config.get('max_quota_bytes', 0) tracked_domains.add(domain_name) domain = models.Domain.query.get(domain_name) diff --git a/core/admin/mailu/models.py b/core/admin/mailu/models.py index 42aecbf0..49e57f99 100644 --- a/core/admin/mailu/models.py +++ b/core/admin/mailu/models.py @@ -129,8 +129,8 @@ class Domain(Base): name = db.Column(IdnaDomain, primary_key=True, nullable=False) managers = db.relationship('User', secondary=managers, backref=db.backref('manager_of'), lazy='dynamic') - max_users = db.Column(db.Integer, nullable=False, default=0) - max_aliases = db.Column(db.Integer, nullable=False, default=0) + max_users = db.Column(db.Integer, nullable=False, default=-1) + max_aliases = db.Column(db.Integer, nullable=False, default=-1) max_quota_bytes = db.Column(db.Integer(), nullable=False, default=0) signup_enabled = db.Column(db.Boolean(), nullable=False, default=False) diff --git a/core/admin/mailu/ui/forms.py b/core/admin/mailu/ui/forms.py index 783b7166..e8302199 100644 --- a/core/admin/mailu/ui/forms.py +++ b/core/admin/mailu/ui/forms.py @@ -53,8 +53,8 @@ class LoginForm(flask_wtf.FlaskForm): class DomainForm(flask_wtf.FlaskForm): name = fields.StringField(_('Domain name'), [validators.DataRequired()]) - max_users = fields_.IntegerField(_('Maximum user count'), default=10) - max_aliases = fields_.IntegerField(_('Maximum alias count'), default=10) + max_users = fields_.IntegerField(_('Maximum user count'), [validators.NumberRange(min=-1)], default=10) + max_aliases = fields_.IntegerField(_('Maximum alias count'), [validators.NumberRange(min=-1)], default=10) max_quota_bytes = fields_.IntegerSliderField(_('Maximum user quota'), default=0) signup_enabled = fields.BooleanField(_('Enable sign-up'), default=False) comment = fields.StringField(_('Comment')) diff --git a/core/admin/mailu/ui/templates/domain/list.html b/core/admin/mailu/ui/templates/domain/list.html index 0fa54f4f..2431faa5 100644 --- a/core/admin/mailu/ui/templates/domain/list.html +++ b/core/admin/mailu/ui/templates/domain/list.html @@ -40,8 +40,8 @@ {% endif %}