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
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user