mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2024-12-25 07:47:05 +00:00
enable setting quotas from the command line
This commit is contained in:
parent
832d2ca375
commit
3840443159
@ -57,9 +57,10 @@ def setup_key_auth(mgmt_uri):
|
|||||||
|
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print("Usage: ")
|
print("Usage: ")
|
||||||
print(" tools/mail.py user (lists users)")
|
print(" tools/mail.py user (lists users with quotas)")
|
||||||
print(" tools/mail.py user add user@domain.com [password]")
|
print(" tools/mail.py user add user@domain.com [password]")
|
||||||
print(" tools/mail.py user password user@domain.com [password]")
|
print(" tools/mail.py user password user@domain.com [password]")
|
||||||
|
print(" tools/mail.py user quota user@domain new-quota")
|
||||||
print(" tools/mail.py user remove user@domain.com")
|
print(" tools/mail.py user remove user@domain.com")
|
||||||
print(" tools/mail.py user make-admin user@domain.com")
|
print(" tools/mail.py user make-admin user@domain.com")
|
||||||
print(" tools/mail.py user remove-admin user@domain.com")
|
print(" tools/mail.py user remove-admin user@domain.com")
|
||||||
@ -81,6 +82,10 @@ elif sys.argv[1] == "user" and len(sys.argv) == 2:
|
|||||||
print(user['email'], end='')
|
print(user['email'], end='')
|
||||||
if "admin" in user['privileges']:
|
if "admin" in user['privileges']:
|
||||||
print("*", end='')
|
print("*", end='')
|
||||||
|
if user['quota'] == '0':
|
||||||
|
print(" unlimited", end='')
|
||||||
|
else:
|
||||||
|
print(" " + user['quota'], end='')
|
||||||
print()
|
print()
|
||||||
|
|
||||||
elif sys.argv[1] == "user" and sys.argv[2] in ("add", "password"):
|
elif sys.argv[1] == "user" and sys.argv[2] in ("add", "password"):
|
||||||
@ -116,6 +121,10 @@ elif sys.argv[1] == "user" and sys.argv[2] == "admins":
|
|||||||
if "admin" in user['privileges']:
|
if "admin" in user['privileges']:
|
||||||
print(user['email'])
|
print(user['email'])
|
||||||
|
|
||||||
|
elif sys.argv[1] == "user" and sys.argv[2] == "quota" and len(sys.argv) == 5:
|
||||||
|
# Set a user's quota
|
||||||
|
users = mgmt("/mail/users/quota", { "email": sys.argv[3], "quota": sys.argv[4] })
|
||||||
|
|
||||||
elif sys.argv[1] == "alias" and len(sys.argv) == 2:
|
elif sys.argv[1] == "alias" and len(sys.argv) == 2:
|
||||||
print(mgmt("/mail/aliases"))
|
print(mgmt("/mail/aliases"))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user