Fix graphs device check before auth (#15551)

It should be after the auth check.
This commit is contained in:
Tony Murray 2023-11-06 09:09:25 -06:00 committed by GitHub
parent 11903150c8
commit 489978a923
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,10 +9,9 @@ try {
$device = is_numeric($vars['device'])
? device_by_id_cache($vars['device'])
: device_by_name($vars['device']);
if (empty($device['device_id'])) {
throw new \LibreNMS\Exceptions\RrdGraphException('Device not found');
if (isset($device['device_id'])) {
DeviceCache::setPrimary($device['device_id']);
}
DeviceCache::setPrimary($device['device_id']);
}
// variables for included graphs
@ -59,6 +58,11 @@ try {
return;
}
// check after auth
if (isset($vars['device']) && empty($device['device_id'])) {
throw new \LibreNMS\Exceptions\RrdGraphException('Device not found');
}
$rrd_options = $graph_params . ' ' . $rrd_options;
// command output requested