mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* Device group based access * Use Permissions class to resolve permissions Also give port access based on device access * Convert more pages to use Permissions class * shorten config setting name use Eloquent relationships in several places alphabetize config_definitions.json * Change Models and Permissions * Clean up ajax_search LIMIT sql * Convert more pages to use Permissions class Co-authored-by: Tony Murray <murraytony@gmail.com>
14 lines
427 B
PHP
14 lines
427 B
PHP
<?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
|
|
);
|
|
}
|