noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
export_security_pdf.php
Go to the documentation of this file.
00001 <?php
00002 /*
00003  *   This file is part of NOALYSS.
00004  *
00005  *   NOALYSS is free software; you can redistribute it and/or modify
00006  *   it under the terms of the GNU General Public License as published by
00007  *   the Free Software Foundation; either version 2 of the License, or
00008  *   (at your option) any later version.
00009  *
00010  *   NOALYSS is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with NOALYSS; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 // Copyright Stanislas Pinte stanpinte@sauvages.be
00020 
00021 /*! \file
00022  * \brief Print the user security in pdf
00023  */
00024 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
00025 require_once('class_dossier.php');
00026 $gDossier=dossier::id();
00027 include_once("ac_common.php");
00028 require_once('class_database.php');
00029 require_once("class_pdf.php");
00030 $cn=new Database($gDossier);
00031 //-----------------------------------------------------
00032 // Security
00033 
00034 // Check User
00035 $rep=new Database();
00036 include_once ("class_user.php");
00037 $User=new User($rep);
00038 
00039 //-----------------------------------------------------
00040 // Get User's info
00041 if ( ! isset($_GET['user_id']) )
00042     return;
00043 
00044 $SecUser=new User($rep,$_GET['user_id']);
00045 $admin=0;
00046 $access=$SecUser->get_folder_access($gDossier);
00047 
00048 if ( $access == 'L')
00049 {
00050     $str='Local Admin';
00051     $admin=1;
00052 }
00053 elseif ($access=='R')
00054 {
00055     $str=' Utilisateur normal';
00056 }
00057 elseif ($access=='P')
00058 {
00059     $str=' Extension uniquement';
00060 }
00061 
00062 
00063 if ( $SecUser->admin==1 )
00064 {
00065     $str=' Super Admin';
00066     $admin=1;
00067 }
00068 
00069 
00070 //-----------------------------------------------------
00071 // Print result
00072 
00073 $pdf=new PDF($cn);
00074 $pdf->setDossierInfo(dossier::name().' Sécurité');
00075 $pdf->AliasNbPages();
00076 $pdf->AddPage();
00077 $pdf->SetAuthor('NOALYSS');
00078 $pdf->setTitle("Sécurité",true);
00079 
00080 $str_user=sprintf("( %d ) %s %s [ %s ] - %s",
00081                   $SecUser->id,
00082                   $SecUser->first_name,
00083                   $SecUser->name,
00084                   $SecUser->login,
00085                   $str);
00086 
00087 $pdf->SetFont('DejaVu','B',9);
00088 $pdf->Cell(0,7,$str_user,'B',0,'C');
00089 $pdf->Ln();
00090 if ( $SecUser->active==0)
00091 {
00092     $pdf->SetTextColor(255,0,34);
00093     $pdf->Cell(0,7,'Bloqué',0,0,'R');
00094     $pdf->Ln();
00095 }
00096 
00097 if ( $SecUser->admin==1)
00098 {
00099     $pdf->SetTextColor(0,0,0);
00100     $pdf->setFillColor(239,251,255);
00101     $pdf->Cell(40,7,'Administrateur',1,1,'R');
00102     $pdf->Ln();
00103 }
00104 $pdf->SetTextColor(0,0,0);
00105 
00106 //-----------------------------------------------------
00107 // Journal
00108 $pdf->Cell(0,7,'Accès journaux',1,0,'C');
00109 $pdf->Ln();
00110 $pdf->SetFont('DejaVu','',6);
00111 $Res=$cn->exec_sql("select jrn_def_id,jrn_def_name  from jrn_def ");
00112 $SecUser->db=$cn;
00113 for ($e=0;$e < Database::num_row($Res);$e++)
00114 {
00115     $row=Database::fetch_array($Res,$e);
00116     $pdf->Cell(40,6,$row['jrn_def_name']);
00117     $priv=$SecUser->check_jrn($row['jrn_def_id']);
00118     switch($priv)
00119     {
00120     case 'X':
00121             $pdf->SetTextColor(255,0,34);
00122         $pdf->Cell(30,6,"Pas d'accès");
00123         break;
00124     case 'R':
00125         $pdf->SetTextColor(54,233,0);
00126         $pdf->Cell(30,6,"Lecture");
00127         break;
00128     case 'O':
00129         /**
00130          *non implemente
00131          */
00132         $pdf->Cell(30,6,"Opérations prédéfinies uniquement");
00133         break;
00134     case 'W':
00135         $pdf->SetTextColor(54,233,0);
00136         $pdf->Cell(30,6,'Ecriture');
00137         break;
00138     }
00139     $pdf->SetTextColor(0);
00140     $pdf->Ln();
00141 }
00142 
00143 //-----------------------------------------------------
00144 // Follow_Up
00145 $pdf->SetFont('DejaVu','B',9);
00146 $pdf->Cell(0,7,'Accès action',1,0,'C');
00147 $pdf->Ln();
00148 $pdf->SetFont('DejaVu','',6);
00149 $Res=$cn->exec_sql(
00150          "select ac_id, ac_description from action   order by ac_description ");
00151 
00152 $Max=Database::num_row($Res);
00153 
00154 for ( $i =0 ; $i < $Max; $i++ )
00155 {
00156     $l_line=Database::fetch_array($Res,$i);
00157     $pdf->Cell(90,6,$l_line['ac_description']);
00158     $right=$SecUser->check_action($l_line['ac_id']);
00159     switch ($right)
00160     {
00161     case 0:
00162         $pdf->SetTextColor(255,0,34);
00163 
00164         $pdf->Cell(30,6,"Pas d'accès");
00165         break;
00166     case 1:
00167     case 2:
00168         $pdf->SetTextColor(54,233,0);
00169         $pdf->Cell(30,6,"Accès");
00170         break;
00171     }
00172     $pdf->SetTextColor(0);
00173 
00174     $pdf->Ln();
00175 }
00176 $fDate=date('dmy-HI');
00177 $pdf->Output('security-'.$fDate.'pdf','D');
00178 ?>
 All Data Structures Namespaces Files Functions Variables Enumerations