The following issue has been RESOLVED. ====================================================================== http://www.dbmail.org/mantis/view.php?id=125 ====================================================================== Reported By: aaron Assigned To: paul ====================================================================== Project: DBMail Issue ID: 125 Category: Database layer Reproducibility: always Severity: feature Priority: normal Status: resolved Resolution: fixed Fixed in Version: SVN Trunk ====================================================================== Date Submitted: 27-Nov-04 12:53 CET Last Modified: 06-Mar-06 12:11 CET ====================================================================== Summary: ACL lookups are terribly inefficient Description: ACL lookups are done with one query per acl type. That means at least a dozen queries for each and every time you read a message or open a mailbox for a summary.
Rewriting the queries and some of the db_acl_* functions to select entire rows of acl's in one query would be much preferred. The temptation is then to cache the ACL values in a bitfield structure. Perhaps not so a bad an idea! ====================================================================== ---------------------------------------------------------------------- ilja - 29-Nov-04 10:45 ---------------------------------------------------------------------- FYI: When I first programmed the ACL code, I conciously made the decision to not make this extremely efficient. I wanted to have (somewhat) clean, working code first, and optimize later. There are a few ways in which this can be optimized. Getting all privileges for a user on a mailbox at once, and storing them in a bitfield seems like a very reasonable approach. I'm not completely sure on where to store this bitfield though. It could be a static variable in db_acl_has_right() for instance, but maybe we should try to avoid using statics.. ---------------------------------------------------------------------- aaron - 22-Dec-04 17:07 ---------------------------------------------------------------------- Added a listing of the functions which calls acl_has_right. When called three or four times in succession, a SELECT is done each time for a different column of the same row of the same table. ---------------------------------------------------------------------- OutboundIndex - 04-Feb-05 21:58 ---------------------------------------------------------------------- I have a special shared mailbox for multiple users to report missed spam back to me, such as [EMAIL PROTECTED] The users just set up an IMAP account in their Thunderbird, Eudora or Outlook and do a MOVE operation from their inbox to the junk@ IMAP folder in their email client. This works fine w/dbmail BUT I need to set permissions to "insert" only - so that users do not see any of the messages in the junk@ mailbox folder. They are all given the same user / pass. I set up an ACL table entry with the mailbox_idnr, the owner_idnr, and tried a 1 in the insert column. Seemed to have no effect on my ability to read messages in the folder from my email client. Tried a 5 in the insert column, still no effect. Any ideas what I need to do to prevent reading and allow only writing to this mailbox? - April ---------------------------------------------------------------------- aaron - 05-Feb-05 00:48 ---------------------------------------------------------------------- First try a 0 in the column read_flag. If that doesn't work, please follow up to the mailing list and not this bug -- it is specifcally a placeholder for a project I am working on to make ACL lookups more efficient. ---------------------------------------------------------------------- paul - 06-Mar-06 12:11 ---------------------------------------------------------------------- I've fixed this problem. Issue History Date Modified Username Field Change ====================================================================== 27-Nov-04 12:53 aaron New Issue 29-Nov-04 10:45 ilja Note Added: 0000381 22-Dec-04 17:06 aaron File Added: imapacl.c 22-Dec-04 17:06 aaron File Added: imapacls.c 22-Dec-04 17:06 aaron File Deleted: imapacl.c 22-Dec-04 17:07 aaron Note Added: 0000461 04-Feb-05 21:58 OutboundIndex Note Added: 0000577 05-Feb-05 00:48 aaron Note Added: 0000578 06-Mar-06 12:11 paul Note Added: 0001022 06-Mar-06 12:11 paul Assigned To aaron => paul 06-Mar-06 12:11 paul Status assigned => resolved 06-Mar-06 12:11 paul Resolution open => fixed 06-Mar-06 12:11 paul Fixed in Version => SVN Trunk ======================================================================