The portal derives the device MAC instead of trusting the caller
This commit is contained in:
@@ -253,6 +253,24 @@ class UnifiApiClient
|
||||
return ! empty($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* The client currently holding this IP, or null.
|
||||
*
|
||||
* Reads the cached client list rather than querying per IP: the portal calls
|
||||
* this once per connection attempt, and a class arriving at once would
|
||||
* otherwise be one controller round trip each.
|
||||
*/
|
||||
public function findClientByIp(string $ip): ?array
|
||||
{
|
||||
foreach ($this->getActiveClients() as $client) {
|
||||
if (($client['ip'] ?? null) === $ip) {
|
||||
return $client;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function kickClient(string $mac): array
|
||||
{
|
||||
Cache::forget('unifi:clients');
|
||||
|
||||
Reference in New Issue
Block a user