From 7127a944a196b99c4208a65917edb45b3a21cf40 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 18 Aug 2021 10:53:32 -0400 Subject: [PATCH] Use event->canView so that events in snapshots can be exported --- web/skins/classic/includes/export_functions.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/web/skins/classic/includes/export_functions.php b/web/skins/classic/includes/export_functions.php index 2af1764ef..4d32b85fe 100644 --- a/web/skins/classic/includes/export_functions.php +++ b/web/skins/classic/includes/export_functions.php @@ -772,8 +772,12 @@ function exportFileList( $exportVideo, $exportMisc ) { - if (!canView('Events') or !$event) { - ZM\Error("Can't view events or !event"); + if (!$event) { + ZM\Error("Empty event passed to exportFileList"); + return; + } + if (!$event->canView('Events')) { + ZM\Error('Can\'t view event '.$event->Id()); return; } @@ -883,7 +887,7 @@ function exportEvents( $export_root = 'zmExport' ) { - if (!canView('Events')) { + if (!(canView('Events') or canView('Snapshots'))) { ZM\Error('You do not have permission to view events.'); return false; } else if (empty($eids)) { @@ -923,6 +927,11 @@ function exportEvents( } foreach ($eids as $eid) { $event = new ZM\Event($eid); + if (!$event->canView()) { + global $user; + ZM\Warning('User '.($user?$user['Username']:'').' cannot view event '.$event->Id()); + continue; + } $event_dir = $export_dir.'/'.$event->Id(); if (!(mkdir($event_dir) or file_exists($event_dir))) { ZM\Error("Can't mkdir $event_dir");