Permissions script

From Zarafa wiki

Jump to: navigation, search

The following script can be used in order to set permissions on a store from the commandline, active or inactive.
In order to use it you must run it as follows: php ./mailbox-permissions.php <user/group> <target store>

By default, the script sets the permissions on all folders in the store.
If you wish to change this you can edit commented the lines below in the script.
This allows you to disallow access to them or give readonly/write permissions.

Folders ($folderentryids[<number>]):
0 - Deleted Items
1 - Sent Items
2 - Outbox
3 - Inbox
4 - Tasks
5 - Calendar
6 - Notes
7 - Journal
8 - Calendar
9 - Drafts
10 - Junk mail folder

// Set 'folder visible' on root folder, causes store to be openable 'permanently'
SetSecurity($userstore, "", array($perm_foldervisible));

// Set freebusy (internal) folder on readable by everyone. Make sure this folder always
// has the same security settings as your Calendar. If you don't you will get errors
// stating that the 'free busy information could not be updated' in Outlook.
// SetSecurity($userstore, $freebusy, array($perm_read));

// Set other folders invisible
//SetSecurity($userstore, $folderentryids[0], array($perm_folderinvisible));
//SetSecurity($userstore, $folderentryids[1], array($perm_folderinvisible));
//SetSecurity($userstore, $folderentryids[2], array($perm_folderinvisible));
//SetSecurity($userstore, $folderentryids[3], array($perm_folderinvisible));
//SetSecurity($userstore, $folderentryids[4], array($perm_folderinvisible));
//SetSecurity($userstore, $folderentryids[5], array($perm_folderinvisible));
//SetSecurity($userstore, $folderentryids[6], array($perm_folderinvisible));
//SetSecurity($userstore, $folderentryids[7], array($perm_folderinvisible));
//SetSecurity($userstore, $folderentryids[9], array($perm_folderinvisible));
//SetSecurity($userstore, $folderentryids[10], array($perm_folderinvisible));

// Set calendar to be readable for everyone.
SetSecurity($userstore, $folderentryids[8], array($perm_read));


Script (mailstore-permissions.php): https://github.com/zarafagroupware/zarafa-tools/blob/master/mailstore/mailstore-permissions.php

Personal tools