From a4efa4ff45503a91cee23a90524a3410b3a32912 Mon Sep 17 00:00:00 2001 From: Ryan Date: Sat, 6 Dec 2025 04:02:14 -0500 Subject: [PATCH] release(v2.3.5): make client portals ACL-aware and improve admin UX --- CHANGELOG.md | 19 ++ public/api/pro/portals/submitForm.php | 23 +- public/js/adminPanel.js | 2 +- public/js/adminPortals.js | 325 ++++++++++++++++++++------ public/js/portal.js | 103 ++++++-- public/portal.html | 5 + src/controllers/AdminController.php | 192 +++++++-------- src/controllers/PortalController.php | 154 ++++++++---- 8 files changed, 608 insertions(+), 215 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d9dac0..9520d78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,28 @@ # Changelog +## Changese 12/6/2025 (v2.3.5) + +release(v2.3.5): make client portals ACL-aware and improve admin UX + +- Wire PortalController into ACL.php and expose canUpload/canDownload flags +- Gate portal uploads/downloads on both portal flags and folder ACL for logged-in users +- Normalize legacy portal JSON (uploadOnly) with new allowDownload checkbox semantics +- Disable portal upload UI when uploads are turned off; hide refresh when downloads are disabled +- Improve portal subtitles (“Upload & download”, “Upload only”, etc.) and status messaging +- Add quick-access buttons in Client Portals modal for Add user, Folder access, and User groups +- Enforce slug + folder as required on both frontend and backend, with inline hints and scroll-to-first-error +- Auto-focus newly created portals’ folder input for faster setup +- Raise user permissions modal z-index so it appears above the portals modal +- Enhance portal form submission logging with better client IP detection (X-Forwarded-For / X-Real-IP aware) + +--- + ## Changes 12/5/2025 (v2.3.4) release(v2.3.4): fix(admin): use textContent for footer preview to satisfy CodeQL +--- + ## Changes 12/5/2025 (v2.3.3) release(v2.3.3): footer branding, Pro bundle UX + file list polish diff --git a/public/api/pro/portals/submitForm.php b/public/api/pro/portals/submitForm.php index 202d99d..9ab7309 100644 --- a/public/api/pro/portals/submitForm.php +++ b/public/api/pro/portals/submitForm.php @@ -58,6 +58,27 @@ try { require_once $subPath; $submittedBy = (string)($_SESSION['username'] ?? ''); + + // ───────────────────────────── + // Better client IP detection + // ───────────────────────────── + $ip = ''; + if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { + // Can be a comma-separated list; use the first non-empty + $parts = explode(',', (string)$_SERVER['HTTP_X_FORWARDED_FOR']); + foreach ($parts as $part) { + $candidate = trim($part); + if ($candidate !== '') { + $ip = $candidate; + break; + } + } + } elseif (!empty($_SERVER['HTTP_X_REAL_IP'])) { + $ip = trim((string)$_SERVER['HTTP_X_REAL_IP']); + } elseif (!empty($_SERVER['REMOTE_ADDR'])) { + $ip = trim((string)$_SERVER['REMOTE_ADDR']); + } + $payload = [ 'slug' => $slug, 'portalLabel' => $portal['label'] ?? '', @@ -69,7 +90,7 @@ try { 'notes' => $notes, ], 'submittedBy' => $submittedBy, - 'ip' => $_SERVER['REMOTE_ADDR'] ?? '', + 'ip' => $ip, 'userAgent' => $_SERVER['HTTP_USER_AGENT'] ?? '', 'createdAt' => gmdate('c'), ]; diff --git a/public/js/adminPanel.js b/public/js/adminPanel.js index 1a9f73d..0e42a2f 100644 --- a/public/js/adminPanel.js +++ b/public/js/adminPanel.js @@ -1968,7 +1968,7 @@ export function openUserPermissionsModal() { top: 0; left: 0; width: 100vw; height: 100vh; background-color: ${overlayBackground}; display: flex; justify-content: center; align-items: center; - z-index: 3500; + z-index: 10000; `; userPermissionsModal.innerHTML = `