On 06-11-13 15:18, Matt . wrote:
> OK, thanks so far!
> 
> It seems that every folder is seen as "mailbox" this is actually great
> but not for me in this I think. If a user adds a folder I need to run a
> trigger too I think.

I'm not sure I understand. Using SQL triggers you can make sure that for
every row inserted into dbmail_mailboxes, a corresponding row is
inserted into dbmail_acl. Who, what and when a row is added to mailboxes
is then not important.

The actual trigger you can customize to your liking, so you can exclude
some mailboxes, or include just INBOX, etc.

CREATE TRIGGER insert_acl AFTER INSERT ON dbmail_mailboxes
FOR EACH ROW
BEGIN
INSERT INTO dbmail_acl
  (user_id, mailbox_id,
   lookup_flag, read_flag, seen_flag, write_flag, insert_flag, post_flag,
   create_flag, delete_flag, administer_flag, deleted_flag, expunge_flag)
VALUES (
   NEW.owner_idnr, NEW.mailbox_idnr,
   1, 1, 1, 1, 1, 1,
   1, 0, 0, 0, 0);

I haven't tested the actual ACL defined here, but it should prevent
users from deleting messages or mailboxes.

One caveat: the dbmail_acl table is only used by IMAP, so do not allow
POP3 access unless you're looking for trouble.

-- 
________________________________________________________________
Paul J Stevens       pjstevns @ gmail, twitter, github, linkedin

  * Premium Hosting Services and Web Application Consultancy *

           www.nfg.nl/[email protected]/+31.85.877.99.97
________________________________________________________________
_______________________________________________
DBmail mailing list
[email protected]
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail

Reply via email to