Clearing the "don't inherit grants from parent folder"(i) flag
Article Information |
---|
This article applies to the following ZCS versions. |
Description
If you have already shared and revoked permissions for a folder, you may experience problems sharing it again. The following steps will clear the "don't inherit grants from parent folder" (i) flag. To correct this problem, follow the steps below.
How to clear the i flag
The "don't inherit grants from parent folder"(i) flag can be cleared by the "zmmailbox mff" command, as follows:
1. Find out and remember the currently set flags:
zmmailbox -z -m {user-name} gf {folder-path}
- e.g.
>zmmailbox -z -m user1@test.com gf /Inbox { "color": "defaultColor", "contentSequence": 1, "defaultView": "message", "flags": "ui", "grants": [], "id": "2", "isCheckedInUI": false, "isExcludedFromFreeBusy": false, "isSyncEnabled": false, "isSyncFolder": false, "isSystemFolder": true, "itemCount": 222, "name": "Inbox", "parentId": "1", "path": "/Inbox", "pathURLEncoded": "/Inbox", "size": 7592687, "subFolders": [], "unreadCount": 222 }
The current flags are "ui" in the example.
2. Remove only the i (no inherit) flag and preserve all other flags:
zmmailbox -z -m {user-name} mff {folder-path} {flags}
Continuing with the example in step 1, e.g.
zmmailbox -z -m user1@test.com mff /Inbox u
3. Check that it is updated as expected. The 'i' flag should be gone and all
other flags should be still present.
e.g.
>zmmailbox -z -m user1@test.com gf /Inbox { "color": "defaultColor", "contentSequence": 1, "defaultView": "message", "flags": "u", "grants": [], "id": "2", "isCheckedInUI": false, "isExcludedFromFreeBusy": false, "isSyncEnabled": false, "isSyncFolder": false, "isSystemFolder": true, "itemCount": 222, "name": "Inbox", "parentId": "1", "path": "/Inbox", "pathURLEncoded": "/Inbox", "size": 7592687, "subFolders": [], "unreadCount": 222 }
Automated script
(from dsacchet)
#!/bin/bash account=$1 if [ x"$(id -n -u)" != x"zimbra" ] then echo "Ce script doit etre lance sous l'utilisateur zimbra" exit 1 fi zmprov ga "$1" &> /dev/null if [ $? -ne 0 ] then echo "Le compte $account n'existe pas !" exit 1 fi zmmailbox -z -m "$account" gaf | sed "1,2d" | cut -d "/" -f "2-" | while read folder do echo "On traite le dossier '/$folder'" oldflags=$(zmmailbox -z -m "$account" gf "/$folder" | grep flags | head -n 1 | cut -d ":" -f 2 | sed 's@[^"]*"\([^"]*\)".*@\1@') echo " ** old flags : '$oldflags'" newflags=$(echo "$oldflags" | sed 's@i@@g') echo " ** new flags : '$newflags'" if [ x"$oldflags" != x"$newflags" ] then echo "=> On essaye d'appliquer les nouveaux flags" zmmailbox -z -m "$account" mff "/$folder" "$newflags" if [ $? -eq 0 ] then echo "** Nouveaux flags appliques avec succes" else echo "** Nouveau flags non appliques" fi else echo "=> Rien a faire" fi echo "<-------------------------------------------->" done;
The script above is very slow due to the repeated calls to zmmailbox, the one below is less sophisticated but also a lot faster.
zmmailbox -z -m $account gf / | awk -F : '/[{]/ { f=""; next } /"flags": *".*i.*"/{ f=$2; sub(/i/, "", f); next } /"path":/ { if (f != "") { x="modifyFolderFlags "$2" "f; gsub(/",/, "\"", x); print x } }' | zmmailbox -z -m $account -f /dev/stdin
Related Articles