Files
librenms-librenms/includes/caches/toner.inc.php

14 lines
427 B
PHP
Raw Normal View History

<?php
if (Auth::user()->hasGlobalRead()) {
$data['count'] = array('query' => "SELECT COUNT(`toner_id`) FROM toner");
} else {
$device_ids = Permissions::devicesForUser()->toArray() ?: [0];
$perms_sql = "`toner`.`device_id` IN " .dbGenPlaceholders(count($device_ids));
$data['count'] = array(
'query' => "SELECT COUNT(`toner_id`) FROM toner WHERE $perms_sql",
'params' => $device_ids
);
}