diff --git a/app/devices/app_config.php b/app/devices/app_config.php index 0d1a099e95..245c1caaa7 100644 --- a/app/devices/app_config.php +++ b/app/devices/app_config.php @@ -193,6 +193,10 @@ $apps[$x]['permissions'][$y]['name'] = "device_all"; $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $y++; + $apps[$x]['permissions'][$y]['name'] = "device_domain_all"; + $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; + $apps[$x]['permissions'][$y]['groups'][] = "admin"; + $y++; $apps[$x]['permissions'][$y]['name'] = "device_vendor"; $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $apps[$x]['permissions'][$y]['groups'][] = "admin"; diff --git a/app/devices/devices.php b/app/devices/devices.php index 4a30ba124a..d105d903f4 100644 --- a/app/devices/devices.php +++ b/app/devices/devices.php @@ -53,6 +53,10 @@ //get total devices count from the database $sql = "select count(*) from v_devices "; $sql .= "where domain_uuid = :domain_uuid "; + if (!permission_exists('device_all') && !permission_exists('device_domain_all')) { + $sql .= "and device_user_uuid = :user_uuid "; + $parameters['user_uuid'] = $_SESSION['user_uuid']; + } $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $total_devices = $database->select($sql, $parameters, 'column'); @@ -133,6 +137,10 @@ $sql .= ") "; $parameters['domain_uuid'] = $domain_uuid; } + if (!permission_exists('device_all') && !permission_exists('device_domain_all')) { + $sql .= "and d.device_user_uuid = :user_uuid "; + $parameters['user_uuid'] = $_SESSION['user_uuid']; + } if (strlen($search) > 0) { $sql .= "and ("; $sql .= " lower(d.device_mac_address) like :search "; @@ -170,7 +178,7 @@ echo "\n"; echo " \n"; echo " \n"; echo "
\n"; - echo " ".$text['header-devices']." (".$num_rows.")\n"; + echo " ".$text['header-devices']." (".$total_devices.")\n"; echo " \n"; echo "
\n";