1 (edited by BigMichi1 2010-12-09 16:45:15)

Topic: How-To: creating shared folders

hi,
i want you all know how i got shared folders working in iRedMail, so that a user can share some of his folders to other users.
first of all we need a recent version of iRedMail with dovecot 1.2+.

we need a new table in our mysql database to store the information which user shared something to whom.
in my case it's 'vmail'
table structure looks like this one:

CREATE TABLE user_shares (
  from_user varchar(100) not null,
  to_user varchar(100) not null,
  dummy char(1),        -- always '1' currently
  primary key (from_user, to_user)
);

then we need some new entries in our /etc/dovecot/dovecot.conf file, simply add at the end of the file

plugin {
  acl_shared_dict = proxy::acl
}

dict {
  acl = mysql:/etc/dovecot/dovecot-dict-sql.conf
}

the content of the /etc/dovecot/dovecot-dict-sql.conf:

connect = host=localhost dbname=vmail user=*** password=***
map {
  pattern = shared/shared-boxes/user/$to/$from
  table = user_shares
  value_field = dummy

  fields {
    from_user = $from
    to_user = $to
  }
}

(replace the user and password whith your one)

now we have the lookup table for dovecot prepared. simply restart dovecot service to reflect the changes.

to see the shared folders in your favourite client, we need some more changes in the /etc/dovecot/dovecot.conf file.
first we enable the acl plugin:
add the red word to the end of the line:

protocol imap {
  mail_plugins = *** acl imap_acl
}
protocol lda {
  mail_plugins = *** acl
}

add the following at the end of the file:

plugin {
  acl = vfile
}

now we have the acl plugins enabled and configured.

the last step is to add two namespaces, a private one and a shared one, so that we can see the shared folders when listing the folders in the mailbox
add the following add the end of the file:

namespace private {
  separator = /
  prefix =
  #location defaults to mail_location.
  inbox = yes
}

namespace shared {
  separator = /
  prefix = shared/%%u/
  location = maildir:%%h/Maildir:INDEX=/%Lh/Maildir/shared/%%u
  subscriptions = no
  list = children
}

now we can restart the dovecot service and everything is fine. after someone now set the apropriate permissions for a folder to someone the other user can see this folder in his mailbox

References: http://wiki.dovecot.org/SharedMailboxes/Shared

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: How-To: creating shared folders

This is wonderful. Big thanks smile

I do plan to achieve shared folder in iRedMail-0.7.0, and make it work with Roundcube-0.5.x. And you did it for us, that's great.

Also, did you test this with Roundcube-0.5.0-beta1? it supports shared folder too.

3

Re: How-To: creating shared folders

no i didn't use roundcube i have set it up mainly for horde+imp and thunderbird

4

Re: How-To: creating shared folders

I will test roundcube later these days, maybe next week.

How do you use this feature in Horde and Thunderbird? Thunderbird + IMAP-ACL-Extension?

Thanks again. smile

5

Re: How-To: creating shared folders

in horde+imp all features are build in (setting permissions und subscribe to the folders)
in thunderbird i use the imap-acl extension to set permissions and normal subscribe to read the folders