This patch allows you to control the level of admin that is permitted to set quotas of -1 [disabled] or 0 [unlimited] as in some cases you do not want users to be permitted to use as much disk space as they wish. [ie. a hosted mail provider]
The default state is to allow both domain and global admins to use any quota setting, the next level of control disallows domain admins, and the highest level disallows both domain and global admins. As always, those who can edit the config manually can set any quota they wish.
- config.inc.php: added $CONF['allow_quota_disabled'] and $CONF['allow_quota_unlimited']
- functions.inc.php: rewrite of check_quota() to accomodate extra checks/functionality *
- edit-mailbox.php: fix an issue that arises where a mailbox password could not be edited while the quota is set to a restricted value. Edited to only execute check_quota() if the quota has changed.
- the error text that is raised, "The quota that you specified is to high!" becomes misleading. You may wish to edit $PALANG['pCreate_mailbox_quota_text_error'] and $PALANG['pEdit_mailbox_quota_text_error'] to something more general. ie. "The quota that you specified is invalid."
- restricting disabled [-1] quotas may not be desirable as this will interfere with forward-only domains and disallow forward-only mailboxes. **
- patches generated using v2.3, though code up to r816 appears to be the same.
* I have also included a baseline rewrite of check_quota() with none of the code from my patches, including comments about my reasoning for the change.
** Special thanks to cboltz for some helpful suggestions, and getting me to understand the reasoning for a domain maxquota of -1.