Fixed api list devices query for normal users (#8881)

DO NOT DELETE THIS TEXT

#### Please note

> Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting.

- [x] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/)

#### Testers

If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926`

fixes: https://github.com/librenms/myLibreNMS/issues/37
This commit is contained in:
Tony Murray
2018-07-09 14:23:38 -05:00
committed by Neil Lathwood
parent 73031b1f28
commit 61ee9be20d

View File

@@ -352,7 +352,7 @@ function list_devices()
if (!Auth::user()->hasGlobalRead()) {
$sql .= " AND `device_id` IN (SELECT device_id FROM devices_perms WHERE user_id = ?)";
$sql .= " AND `d`.`device_id` IN (SELECT device_id FROM devices_perms WHERE user_id = ?)";
$param[] = Auth::id();
}
$devices = array();
@@ -834,14 +834,14 @@ function list_available_health_graphs()
'name' => 'device_processor'
));
}
if ($device->storage()->count() > 0) {
array_push($graphs, array(
'desc' => 'Storage',
'name' => 'device_storage'
));
}
if ($device->mempools()->count() > 0) {
array_push($graphs, array(
'desc' => 'Memory Pools',
@@ -1250,7 +1250,7 @@ function list_oxidized()
if ($maps_column == "group" && (!isset($config['oxidized']['group_support']) or $config['oxidized']['group_support'] !== true)) {
continue;
}
foreach ($maps as $field_type => $fields) {
foreach ($fields as $field) {
if (isset($field['regex']) && preg_match($field['regex'].'i', $device[$field_type])) {