/** * logoff client * @param int|string zone id number * @return array * @throws \OPNsense\Base\ModelException */ public function logoffAction($zoneid = 0) { if ($this->request->isOptions()) { // return empty result on CORS preflight return array(); } else { $this->sessionClose(); $clientSession = $this->clientSession((string)$zoneid); if ($clientSession['clientState'] == 'AUTHORIZED' && $clientSession['authenticated_via'] != '---ip---' && $clientSession['authenticated_via'] != '---mac---' ) { // you can only disconnect a connected client $backend = new Backend(); $statusRAW = $backend->configdpRun( "captiveportal disconnect", array($zoneid, $clientSession['sessionId'], 'json') ); $status = json_decode($statusRAW, true); if ($status != null) { $this->getLogger("captiveportal")->info( "LOGOUT " . $clientSession['userName'] . " (".$this->getClientIp().") zone " . $zoneid ); return $status; } } } return array("clientState" => "UNKNOWN", "ipAddress" => $this->getClientIp()); }