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:
Tony Murray
2018-04-07 15:55:28 -05:00
committed by Neil Lathwood
parent 2ece84495d
commit 7250376104
193 changed files with 949 additions and 510 deletions

View File

@@ -15,13 +15,15 @@
* @author LibreNMS Contributors
*/
use LibreNMS\Authentication\Auth;
$graph_type = 'processor_usage';
$where = 1;
$sql = ' FROM `processors` AS `P` LEFT JOIN `devices` AS `D` ON `P`.`device_id` = `D`.`device_id`';
if (is_admin() === false && is_read() === false) {
if (!Auth::user()->hasGlobalRead()) {
$sql .= ' LEFT JOIN `devices_perms` AS `DP` ON `P`.`device_id` = `DP`.`device_id`';
$where .= ' AND `DP`.`user_id`=?';
$param[] = $_SESSION['user_id'];
$param[] = Auth::id();
}
$sql .= " WHERE $where";