def modify_folder_grant(
        self,
        folder_ids,
        perm,
        zid=None,
        grantee_name=None,
        gt='usr',
        flags=None
    ):
        """
        :param folder_ids: list of ids
        :param perm: permission to grant to the user on folder(s)
        :param zid: id of user to grant rights
        :param grantee_name: email address of user to grant rights
        :param flags: folder's flags
        """
        f_ids = self._return_comma_list(folder_ids)

        params = {'action': {
            'id': f_ids,
            'op': 'grant',
            'grant': {'perm': perm, 'gt': gt}
        }}

        if perm == 'none':
            params['action']['op'] = '!grant'
            params['action']['zid'] = zid
            # Remove key to raise Zimsoap exception if no zid provided
            if not zid:
                params['action'].pop('zid', None)

        if grantee_name:
            params['action']['grant']['d'] = grantee_name
        elif zid:
            params['action']['grant']['zid'] = zid
        else:
            raise TypeError('missing zid or grantee_name')

        self.request('FolderAction', params)
:param folder_ids: list of ids
        :param perm: permission to grant to the user on folder(s)
        :param zid: id of user to grant rights
        :param grantee_name: email address of user to grant rights
        :param flags: folder's flags