ajax/event.php action=video appended monitorLimitSql() after GROUP BY,
where "GROUP BY E.Id AND MonitorId IN (...)" only changes the grouping
and filters nothing. A user denied a monitor could still have
zmvideo.pl encode that monitor's events and learn the file's path.
Put the limit in the WHERE clause and also check the loaded event with
Event::canView(), which applies the monitor's permission and the
Snapshots rule. monitorLimitSql() has no other caller.
tests/php/test_event_video_requires_view.php covers a denied monitor, a
missing event, a Snapshots-only user and a user without Events or
Snapshots view; 5 of its 11 checks fail before this change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit c95d4decbc)