From 757d7ae01d5e9915aa8472f4c9ce8121722ddb47 Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Fri, 17 Jan 2025 12:48:46 +0900 Subject: [PATCH] ACL Login fixes for legacy id lookups add an edit access id lookup to cuid Fix unit_cuid not initialized, only old unit_id --- www/lib/CoreLibs/ACL/Login.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/www/lib/CoreLibs/ACL/Login.php b/www/lib/CoreLibs/ACL/Login.php index a91e5c0d..86e44388 100644 --- a/www/lib/CoreLibs/ACL/Login.php +++ b/www/lib/CoreLibs/ACL/Login.php @@ -1532,7 +1532,7 @@ class Login $this->acl['page'] = $_SESSION['LOGIN_PAGES_ACL_LEVEL'][$this->page_name]; } - $this->acl['unit_id'] = null; + $this->acl['unit_cuid'] = null; $this->acl['unit_name'] = null; $this->acl['unit_uid'] = null; $this->acl['unit'] = []; @@ -3296,6 +3296,20 @@ HTML; return (string)$_SESSION['LOGIN_UNIT_ACL_LEVEL'][$id]['cuid']; } + /** + * This is a Legacy lookup from the edit access id to cuid for further lookups in the normal list + * + * @param string $cuid edit access cuid + * @return int|false false on not found or edit access id PK + */ + public function loginGetEditAccessIdFromCuid(string $cuid): int|false + { + if (!isset($_SESSION['LOGIN_UNIT_LEGACY'][$cuid])) { + return false; + } + return $_SESSION['LOGIN_UNIT_LEGACY'][$cuid]; + } + /** * Check if admin flag is set *