From b1b1dd1feb65b17fe0cd65520266e5b946ff2c43 Mon Sep 17 00:00:00 2001 From: Jukka Lampikoski Date: Wed, 11 Mar 2026 08:49:22 +0200 Subject: [PATCH] =?UTF-8?q?IP-rajoitus:=20oletusarvo=20'kaikki'=20kent?= =?UTF-8?q?=C3=A4ss=C3=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tyhjä kenttä tai 'kaikki' = ei rajoitusta. UI näyttää 'kaikki' oletuksena uusille yrityksille. Co-Authored-By: Claude Opus 4.6 --- api.php | 2 +- index.html | 2 +- script.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api.php b/api.php index df7bacc..d3eebda 100644 --- a/api.php +++ b/api.php @@ -137,7 +137,7 @@ function getClientIp(): string { */ function isIpAllowed(string $ip, string $allowedIps): bool { $allowedIps = trim($allowedIps); - if ($allowedIps === '') return true; // ei rajoitusta + if ($allowedIps === '' || strtolower($allowedIps) === 'kaikki') return true; // ei rajoitusta $entries = preg_split('/[\s,]+/', $allowedIps, -1, PREG_SPLIT_NO_EMPTY); $ipLong = ip2long($ip); if ($ipLong === false) return false; diff --git a/index.html b/index.html index e8dfd71..20526e6 100644 --- a/index.html +++ b/index.html @@ -763,7 +763,7 @@
- Yksi IP tai CIDR per rivi. Tyhjä = ei rajoitusta. Superadmin ohittaa aina. + Yksi IP tai CIDR per rivi. "kaikki" = ei rajoitusta. Superadmin ohittaa aina.
diff --git a/script.js b/script.js index bed2d71..5b1dd75 100644 --- a/script.js +++ b/script.js @@ -2303,7 +2303,7 @@ async function showCompanyDetail(id) { }); // Sallitut IP-osoitteet - document.getElementById('company-edit-allowed-ips').value = comp?.allowed_ips || ''; + document.getElementById('company-edit-allowed-ips').value = comp?.allowed_ips || 'kaikki'; // Vaihda aktiivinen yritys jotta API-kutsut kohdistuvat oikein await apiCall('company_switch', 'POST', { company_id: id });