300) { $row = db_get_user($_SESSION["auth_user"]); if ($row) { $_SESSION["auth_data"] = db_build_auth_data($row); init_active_org($_SESSION["auth_data"]); } $_SESSION["last_reload_time"] = time(); } if (!isset($_SESSION["last_reload_time"])) { $_SESSION["last_reload_time"] = time(); } } } function user_is_authenticated(): bool { return isset($_SESSION["auth_ok"]) && $_SESSION["auth_ok"] === true; } function user_has_permission(string $perm): bool { return in_array($perm, $_SESSION["auth_data"]["permissions"] ?? [], true); }