mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
refactor: Don't access $_SESSION directly for Auth (#8513)
* Don't access $_SESSION directly for Auth * fix style * add property annotations
This commit is contained in:
committed by
Neil Lathwood
parent
2ece84495d
commit
7250376104
@@ -17,6 +17,8 @@
|
||||
* @author LibreNMS Contributors
|
||||
*/
|
||||
|
||||
use LibreNMS\Authentication\Auth;
|
||||
|
||||
$pagetitle[] = "Alert Stats";
|
||||
|
||||
$sql = "";
|
||||
@@ -27,12 +29,12 @@ if (isset($device['device_id']) && $device['device_id'] > 0) {
|
||||
);
|
||||
}
|
||||
|
||||
if ($_SESSION['userlevel'] >= '5') {
|
||||
if (Auth::user()->hasGlobalRead()) {
|
||||
$query = "SELECT DATE_FORMAT(time_logged, '".$config['alert_graph_date_format']."') Date, COUNT(alert_log.rule_id) totalCount, alert_rules.severity Severity FROM alert_log,alert_rules WHERE alert_log.rule_id=alert_rules.id AND `alert_log`.`state` != 0 $sql GROUP BY DATE_FORMAT(time_logged, '".$config['alert_graph_date_format']."'),alert_rules.severity";
|
||||
}
|
||||
|
||||
if ($_SESSION['userlevel'] < '5') {
|
||||
$query = "SELECT DATE_FORMAT(time_logged, '".$config['alert_graph_date_format']."') Date, COUNT(alert_log.device_id) totalCount, alert_rules.severity Severity FROM alert_log,alert_rules,devices_perms WHERE alert_log.rule_id=alert_rules.id AND `alert_log`.`state` != 0 $sql AND alert_log.device_id = devices_perms.device_id AND devices_perms.user_id = " . $_SESSION['user_id'] . " GROUP BY DATE_FORMAT(time_logged, '".$config['alert_graph_date_format']."'),alert_rules.severity";
|
||||
if (!Auth::user()->hasGlobalRead()) {
|
||||
$query = "SELECT DATE_FORMAT(time_logged, '".$config['alert_graph_date_format']."') Date, COUNT(alert_log.device_id) totalCount, alert_rules.severity Severity FROM alert_log,alert_rules,devices_perms WHERE alert_log.rule_id=alert_rules.id AND `alert_log`.`state` != 0 $sql AND alert_log.device_id = devices_perms.device_id AND devices_perms.user_id = " . Auth::id() . " GROUP BY DATE_FORMAT(time_logged, '".$config['alert_graph_date_format']."'),alert_rules.severity";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user