time()-3600*24*2)); } $refreshParent = true; return; } // Group edit actions # Deleting a group also needs edit on each of its monitors, checked below. if ( ! canEdit('Groups') ) { ZM\Warning('Need group edit permissions to edit groups'); return; } if ( $action == 'delete' ) { if ( !empty($_REQUEST['gid']) ) { foreach ( ZM\Group::find(array('Id'=>$_REQUEST['gid'])) as $Group ) { // Deleting a group removes its monitors from it, which can lift a deny on them. if (!ZM\Group::canEditMembership($Group->MonitorIds())) { ZM\Warning('Need edit permission on every monitor in group '.$Group->Id().' to delete it'); $error_message .= 'You need edit permission on every monitor in group '.validHtmlStr($Group->Name()).' to delete it.
'; continue; } if ($Group->delete() === false) { $error_message .= 'Error deleting group: '.validHtmlStr(dbLastError()).'
'; continue; } ZM\AuditAction('delete', 'group', $Group->Id(), 'Name: '.$Group->Name()); } } if (!$error_message) { $redirect = '?view=groups'; $refreshParent = true; } } # end if action ?>