droit par défaut = W return 2; } $Priv=pg_fetch_array($Res2,0); if ( $Priv['uj_priv'] == "X" ) return 0; if ( $Priv['uj_priv'] == "R" ) return 1; if ( $Priv['uj_priv'] == "W" ) return 2; echo '

Undefined right

'; echo_debug ("Droit Journal $Priv[uj_priv]"); return 0; } if ( $Def['priv_priv'] == "R") { // Si droit pas défaut == Lire if ( $PrivJrn == 0 ) { // Pas de droit spécifique sur jrn => droit par défaut = Lire return 1; } $Priv=pg_fetch_array($Res2,0); if ( $Priv['uj_priv'] == "X" ) return 0; if ( $Priv['uj_priv'] == "R" ) return 1; if ( $Priv['uj_priv'] == "W" ) return 2; echo_debug ("Droit Journal $Priv[uj_priv]"); echo '

Undefined right

'; return 0; } echo '

Undefined default right

'; return 0; } /* function CheckAction * Purpose : Check if an user is allowed to do an action * * parm : * - p_dossier dossier id * - p_login user's login * - p_action_id * gen : * - * return: * - 0 no priv * - 1 priv granted * */ function CheckAction ( $p_dossier,$p_login,$p_action_id) { if ( CheckIsAdmin ($p_login) ) return 1; $l_Db=sprintf("dossier%d",$p_dossier); $cn=DbConnect($l_Db); $Res=ExecSql($cn,"select * from user_sec_act where ua_login='$p_login' and ua_act_id=$p_action_id"); $Count=pg_NumRows($Res); if ( $Count == 0 ) return 0; if ( $Count == 1 ) return 1; echo "

Invalid action !!! $Count select * from user_sec_act where ua_login='$p_login' and ua_act_id=$p_action_id

"; } /* function CheckIsAdmin * Purpose : Check if an user is an administrator * * parm : * - $p_user user login * gen : * - * return: * - 0 if no * - 1 if yes * */ function CheckIsAdmin($p_user) { if ( $p_user == 'phpcompta') return 1; $sql="select use_id from ac_users where use_login='$p_user' and use_active=1 and use_admin=1 "; $cn=DbConnect(); $isAdmin=CountSql($cn,$sql); return $isAdmin; } ?>