Use event->canView so that events in snapshots can be exported

This commit is contained in:
Isaac Connor 2021-08-18 10:53:32 -04:00
parent ba9a871daf
commit 7127a944a1
1 changed files with 12 additions and 3 deletions

View File

@ -772,8 +772,12 @@ function exportFileList(
$exportVideo, $exportVideo,
$exportMisc $exportMisc
) { ) {
if (!canView('Events') or !$event) { if (!$event) {
ZM\Error("Can't view events or !event"); ZM\Error("Empty event passed to exportFileList");
return;
}
if (!$event->canView('Events')) {
ZM\Error('Can\'t view event '.$event->Id());
return; return;
} }
@ -883,7 +887,7 @@ function exportEvents(
$export_root = 'zmExport' $export_root = 'zmExport'
) { ) {
if (!canView('Events')) { if (!(canView('Events') or canView('Snapshots'))) {
ZM\Error('You do not have permission to view events.'); ZM\Error('You do not have permission to view events.');
return false; return false;
} else if (empty($eids)) { } else if (empty($eids)) {
@ -923,6 +927,11 @@ function exportEvents(
} }
foreach ($eids as $eid) { foreach ($eids as $eid) {
$event = new ZM\Event($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(); $event_dir = $export_dir.'/'.$event->Id();
if (!(mkdir($event_dir) or file_exists($event_dir))) { if (!(mkdir($event_dir) or file_exists($event_dir))) {
ZM\Error("Can't mkdir $event_dir"); ZM\Error("Can't mkdir $event_dir");