Hi all,

I've written an implementation of group quotas for dbmail-1.2.3

At the moment it works with postgres only, but please take a look and give me 
feedback now, before I go on to change the mysql version and the admin tools.

I've attached a patch for src/dbmail-1.2.3/pgsql/dbpgsql.c

Implementation is as follows:

Users are grouped by their client_idnr.
To create a limit of 10M for client number 2, insert the following into the 
config table:

INSERT INTO config (item,value) VALUES ('client_maxmail_2',10485760)

When a mail arrives, following procedure is followed:
First, the user's individual maxmail is checked as normal.
If the message passes that check, then the config table is checked for a limit 
for his client_idnr. 
If no such limit exists, or the limit is 0, the message is allowed.
If a limit does exist, the size of all mailboxes belonging to users with that 
client_idnr is calculated.
If the message would push the usage over the client's limit, the message is 
rejected, otherwise the message is allowed.

This gives the flexability to retain a limit on individual accounts in the 
group, while allowing other members to use up as much of the group quota as 
they want.
The one thing that cannot be done is to give a user within the group unlimited 
usage regardless of the group quota. That would defy the point of group quotas, 
although there is an easy workaround which I could implement should there be 
demand for it.

I've also changed the logic in the individual test - 
it used to first calculate the total usage for that individual, and then 
retrieve the individual's limit.
It now retrieves the limit first, and if it's 0, it skips calculating the 
user's usage.

I'll wait until people have had a chance to find problems with the 
implementation before writing the mysql version.

Also, I'll alter dbmail-adduser to let quotas be set with it.
Any suggestions as to the syntax for this?
I'm thinking of using
 dbmail-adduser g clientid -q maxmail

As soon as I have it done for 1.2.x, I'll do it for 2.x, so the sooner I get 
feedback, the sooner it can get into the tree.

-fr.

--
Feargal Reilly,
Codeshifter,
Chrysalink Systems.

Attachment: dbpgsql.c.patch
Description: Binary data

Attachment: pgpTRTggztsWc.pgp
Description: PGP signature

Reply via email to