'Action which enables or disables permissions for selected files and
files in selected folders to clipboard (set them private or public).'

def files_set_public_or_private(self, request, set_public, files_queryset, folders_queryset):

    if (not self.has_change_permission(request)):
        raise PermissionDenied
    if (request.method != u'POST'):
        return None
    check_files_edit_permissions(request, files_queryset)
    check_folder_edit_permissions(request, folders_queryset)
    files_count = [0]
    def set_files(files):
        for f in files:
            if (f.is_public != set_public):
                f.is_public = set_public
                f.save()
                files_count[0] += 1
    def set_folders(folders):
        for f in folders:
            set_files(f.files)
            set_folders(f.children.all())
    set_files(files_queryset)
    set_folders(folders_queryset)
    if set_public:
        self.message_user(request, (_(u'Successfully    disabled    permissions    for    %(count)d    files.') % {u'count': files_count[0]}))
    else:
        self.message_user(request, (_(u'Successfully    enabled    permissions    for    %(count)d    files.') % {u'count': files_count[0]}))
    return None
