Open Antoviscomi opened 1 day ago
According to stack overflow, it's because the "cDaoRecord_lizmap_Jx_user_Jx_pgsql" (and jFormsSession) classes are unknown when session is deserialized (by print_r)
If you want to know the currrent user in session, you need to use jelix/lizmap objects ( jAuth::getUserSession()
) or ensure the class used by object in session are defined.
@nworr
If you want to know the currrent user in session, you need to use jelix/lizmap objects (
jAuth::getUserSession()
) or ensure the class used by object in session are defined.
using jAuth::getUserSession()
as follow:
try {
// Prova a ottenere la sessione utente
$user = jAuth::getUserSession();
if ($user && !($user instanceof jAuthDummyUser)) {
// Controlla che l'utente abbia le proprietà id e group
$userId = isset($user->id) ? $user->id : 'N/A';
$group = isset($user->group) ? $user->group : 'N/A';
error_log("Debug: Utente connesso. ID: $userId, Gruppo: $group");
// Verifica se l'utente è admin o registrato
if (in_array($group, ['admins', 'users'])) {
error_log("Debug: Utente autorizzato.");
// Includi il form HTML o reindirizza alla pagina protetta
// include '/var/www/webgism/lizmap/www/mapsm/myscript.php';
exit;
} else {
error_log("Debug: Utente non autorizzato." . print_r($user, true));
}
} else {
error_log("Debug: Utente non autenticato o autenticazione fallita.");
}
} catch (Exception $e) {
error_log("Debug: Errore durante il recupero della sessione utente: " . $e->getMessage());
}
my debug log come out as you can see after correct login in LWC
PHP message: Debug: Utente connesso. ID: , Gruppo: ', referer: http://xxx.xx.xx.xx/webgism/admin.php/auth/login?auth_url_return=%2Fwebgism%2Fmapsm%2Fmyscript.php
When I try to obtain informations on active LWC(PHP) session in my machine by
session_start(); echo '<pre>'; print_r($_SESSION); echo '</pre>';
I receive this response caused by a request that throws an error about an incomplete object in the PHP session:
then I'm not able to pass $_SESSION info to another php because of session crash. can someone tell me if is it a bug or a misconfiguration caused by me? And in both cases what can i do?
Versions, safeguards, check summary etc
Versions :
List of safeguards :
* Mode : normal * Allow parent folder : yes * Number of parent : 10 folder(s) * Prevent other drive : no * Prevent PG service : no * Prevent PG Auth DB : no * Force PG user&pass : no * Prevent ECW : no
Check Lizmap plugin
Operating system
Ubuntu 22.04
Browsers
Chrome
Browsers version
Versione 129.0.6668.58 (Build ufficiale) (a 64 bit)
Relevant log output
No response