From ef10ecc06a1ff653b37200b8df20ed340240e136 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 12 Apr 2021 15:18:29 -0400 Subject: [PATCH] Allow users to start/stop alarms without monitor view permission. When forcing an alarm, disable recording first so that the alarm is distinct. This is necessary due to permissions. --- src/zmu.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/zmu.cpp b/src/zmu.cpp index 384af99a3..e2b2c9d81 100644 --- a/src/zmu.cpp +++ b/src/zmu.cpp @@ -179,7 +179,7 @@ bool ValidateAccess(User *user, int mon_id, int function) { if ( user->getEvents() < User::PERM_VIEW ) allowed = false; } - if ( function & (ZMU_ZONES|ZMU_QUERY|ZMU_LIST|ZMU_ALARM|ZMU_CANCEL) ) { + if ( function & (ZMU_ZONES|ZMU_QUERY|ZMU_LIST) ) { if ( user->getMonitors() < User::PERM_VIEW ) allowed = false; } @@ -586,6 +586,9 @@ int main(int argc, char *argv[]) { monitor->GetLastEventId() ); } + + // Ensure that we are not recording. So the forced alarm is distinct from what was recording before + monitor->ForceAlarmOff(); monitor->ForceAlarmOn(config.forced_alarm_score, "Forced Web"); int wait = 10*1000*1000; // 10 seconds while ( ((state = monitor->GetState()) != Monitor::ALARM) and !zm_terminate and wait) {