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.

This commit is contained in:
Isaac Connor 2021-04-12 15:18:29 -04:00
parent e373e871da
commit ef10ecc06a
1 changed files with 4 additions and 1 deletions

View File

@ -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) {