From 43705acd089cecffbdf654280e314f53a1ecc34e Mon Sep 17 00:00:00 2001 From: downtownallday Date: Sun, 16 Feb 2025 20:00:40 -0500 Subject: [PATCH] Remove duplicate functions --- management/mailconfig.py | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/management/mailconfig.py b/management/mailconfig.py index 1dbc4ae6..1722c76b 100755 --- a/management/mailconfig.py +++ b/management/mailconfig.py @@ -950,41 +950,6 @@ def validate_login(email, pw, env): except ldap3.core.exceptions.LDAPInvalidCredentialsResult: return False - - -def get_mail_quota(email, env): - user = find_mail_user(env, email, ['mailboxQuota']) - if user is None: - return ("That's not a user (%s)." % email, 400) - if len(user['mailboxQuota'])==0: - return '0' - else: - return user['mailboxQuota'][0] - -def set_mail_quota(email, quota, env): - # validate that password is acceptable - quota = validate_quota(quota) - - # update the database - conn = open_database(env) - user = find_mail_user(env, email, ['mailboxQuota'], conn) - if user is None: - return ("That's not a user (%s)." % email, 400) - - conn.modify_record(user, { 'mailboxQuota': quota }) - dovecot_quota_recalc(email) - return "OK" - -def dovecot_quota_recalc(email): - # dovecot processes running for the user will not recognize the new quota setting - # a reload is necessary to reread the quota setting, but it will also shut down - # running dovecot processes. Email clients generally log back in when they lose - # a connection. - # subprocess.call(['doveadm', 'reload']) - - # force dovecot to recalculate the quota info for the user. - subprocess.call(["doveadm", "quota", "recalc", "-u", email]) - def validate_quota(quota): # validate quota quota = quota.strip().upper() @@ -998,7 +963,6 @@ def validate_quota(quota): return quota - def get_mail_quota(email, env): user = find_mail_user(env, email, ['mailboxQuota']) if user is None: