Clearing the "don't inherit grants from parent folder"(i) flag

Clearing the "don't inherit grants from parent folder" (i) flag

   KB 3293        Last updated on 07/11/2015  




0.00
(0 votes)
 - This article is a Community contribution and may include unsupported customizations.
 - This article is a Work in Progress, and may be unfinished or missing sections.

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 } /"ownerId":/ { f=""; next } /"path":/ { if (f != "") { x="modifyFolderFlags "$2" "f; gsub(/",/, "\"", x); print x } }' | zmmailbox -z -m $account -f /dev/stdin

Related Articles



Verified Against: Zimbra Collaboration 7.0, 6.0 Date Created: 1/11/2010
Article ID: https://wiki.zimbra.com/index.php?title=Clearing_the_%22don%27t_inherit_grants_from_parent_folder%22(i)_flag Date Modified: 07/11/2015



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »

Jump to: navigation, search