Fix : permit to see the detail of an operation if

the user has access to at least one legder
This commit is contained in:
sparkyx 2005-10-10 09:13:19 +00:00
parent cc28ba8a2b
commit b27df594fd
3 changed files with 23 additions and 10 deletions

View file

@ -68,7 +68,7 @@ if ( ! isset ( $action )) {
echo JS_VIEW_JRN_MODIFY;
//////////////////////////////////////////////////////////////////////
if ( $action == 'update' ) {
if ( ($priv=CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$_GET['p_jrn'])) < 1 ) {
if ( ($priv=CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$_GET['p_jrn'],true)) < 1 ) {
NoAccess();
exit -1;
@ -95,7 +95,7 @@ if ( $action == 'update' ) {
// echo '</div>';
}
if ( isset($_POST['update_record']) ) {
if ( ($priv=CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$p_jrn)) !=2 ) {
if ( ($priv=CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$p_jrn,true)) !=2 ) {
NoAccess();
exit -1;

View file

@ -40,23 +40,35 @@ include_once("postgres.php");
*
*/
function CheckJrn($p_dossier,$p_user,$p_jrn)
function CheckJrn($p_dossier,$p_user,$p_jrn,$p_detail=False)
{
if ( CheckIsAdmin( $p_user) == 1 ) return 2;
$cn=DbConnect($p_dossier);
// Special
// p_jrn = 0 ==> grand livre access if there is no uj_prix=X
// or detail
if ( $p_jrn == 0 ) {
// $n_jrn=CountSql($cn,"select jrn_def_id from jrn_def");
$n_for=CountSql($cn,"select jrn_def_id,uj_priv
if ( $p_detail == false) {
// $n_jrn=CountSql($cn,"select jrn_def_id from jrn_def");
$n_for=CountSql($cn,"select jrn_def_id,uj_priv
from jrn_def left join user_sec_jrn on uj_jrn_id=jrn_def_id
where uj_login='$p_user' and uj_priv='X'");
if ( $n_for == 0 )
return 2;
else
return 0;
if ( $n_for == 0 )
return 2;
else
return 0;
} else {
// For a detail, at least one jrn must be accessible
$n_for=CountSql($cn, " select jrn_def_id,uj_priv
from jrn_def left join user_sec_jrn on uj_jrn_id=jrn_def_id
where uj_login='$p_user' and uj_priv !='X'");
if ( $n_for == 0 )
return 0;
else
return 2;
}
}
// droit spécifique

View file

@ -992,6 +992,7 @@ function GetDataJrnJrId ($p_cn,$p_jr_id) {
jr_id=$p_jr_id
order by j_debit desc");
$MaxLine=pg_NumRows($Res);
echo_debug(__FILE__,__LINE__,"Found $MaxLine lines");
if ( $MaxLine == 0 ) return null;
for ( $i=0; $i < $MaxLine; $i++) {