Thursday, December 3, 2009

Zimbra public folders

When migrating from that other closed source groupware product to Zimbra, you will probably have to setup the system with a Public Folders view, resembling the other product. While it is possible to do in Zimbra, it's a bit cumbersome. The way I did it, is to create a 'user' per public folder, then share it's Inbox with the users that need access (using a mailinglist as share destination is also possible).

The procedure is can be done from the command line:

First create a Folder per user to store the public folders in:

$ zmmailbox -z -m user@domain.be cf --view message /PublicFolders


Then for every public folder account, share it's inbox with that user:

$ zmmailbox -z -m pubfolder@domain.be mfg /Inbox account user@domain.be rwidx


Then mount the share for the user:

$ zmmailbox -z -m user@domain.be cm --view message /PublicFolders/Pubfolder pubfolder@domain.be /Inbox



You can ofcourse script it, with something like this... (will output a script you feed to 'zmmailbox -z')

-------------[ python code ]--------
allusers = ['user1@domain.be', 'user2@domain.be', 'user3@domain.be']
pubfolders = ['folder1@domain.be', 'folder2@domain.be']

def createPublicFolderMap(users):
'''
create a folder to act as a parent for all the public folder submaps
'''

for user in users:
print "selectMailbox " + user
print "createFolder --view message /PublicFolders"

def createAndSharePubFolder(folder, users):
'''
creates the share on the public folder's inbox to the users
and creates a share mountpoint in the users for that inbox
'''
folderName = folder[:folder.find('@')]
folderName = folderName[0].upper()+folderName[1:]

print "selectMailbox " + folder
for user in users:
print "modifyFolderGrant /Inbox account "+user+" rwidx"

for user in users:
print "selectMailbox " + user
print "createMountPoint --view message /PublicFolders/" \
+folderName+" "+folder+" /Inbox"


createPublicFolderMap(allusers)
for pubfolder in pubfolders:
createAndSharePubFolder(pubfolder, allusers)
-------------[ python code ]--------

No comments: