noalyss Version-9
export_security_pdf.php
Go to the documentation of this file.
1<?php
2/*
3 * This file is part of NOALYSS.
4 *
5 * NOALYSS is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * NOALYSS is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with NOALYSS; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18*/
19// Copyright Stanislas Pinte stanpinte@sauvages.be
20
21/*! \file
22 * \brief Print the user security in pdf
23 */
24if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
26require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
28
30try
31{
32 $user_id=$http->get("user_id");
33}
34catch (Exception $exc)
35{
36 error_log($exc->getTraceAsString());
37 return;
38}
39
40//-----------------------------------------------------
41// Security
42
43// Check User
45$User=new Noalyss_user($rep);
46
47//-----------------------------------------------------
48// Get User's info
49
50$SecUser=new Noalyss_user($rep,$user_id);
52$access=$SecUser->get_folder_access($gDossier);
53
54if ( $access == 'L')
55{
56 $str=_('Local Admin');
57 $admin=1;
58}
59elseif ($access=='R')
60{
61 $str=_('Utilisateur normal');
62}
63elseif ($access=='P')
64{
65 $str=_('Extension uniquement');
66}
67
68
69if ( $SecUser->admin==1 )
70{
71 $str=_(' Super Admin');
72 $admin=1;
73}
74
75
76//-----------------------------------------------------
77// Print result
78
80$pdf->setDossierInfo(dossier::name()._(' Sécurité'));
81$pdf->AliasNbPages();
82$pdf->AddPage();
83$pdf->SetAuthor('NOALYSS');
84$pdf->setTitle(_("Sécurité"),true);
85
86$str_user=sprintf("( %d ) %s %s [ %s ] - %s",
87 $SecUser->id,
88 $SecUser->first_name,
89 $SecUser->name,
90 $SecUser->login,
91 $str);
92
93$pdf->SetFont('DejaVu','B',9);
94$pdf->write_cell(0,7,$str_user,'B',0,'C');
95$pdf->line_new();
96if ( $SecUser->active==0)
97{
98 $pdf->SetTextColor(255,0,34);
99 $pdf->write_cell(0,7,_('Bloqué'),0,0,'R');
100 $pdf->line_new();
101}
102
103if ( $SecUser->admin==1)
104{
105 $pdf->SetTextColor(0,0,0);
106 $pdf->setFillColor(239,251,255);
107 $pdf->write_cell(40,7,_('Administrateur'),1,1,'R');
108 $pdf->line_new();
109}
110$pdf->SetTextColor(0,0,0);
111
112//-----------------------------------------------------
113// Journal
114$pdf->write_cell(0,7,_('Accès journaux'),1,0,'C');
115$pdf->line_new();
116$pdf->SetFont('DejaVu','',6);
117$Res=$cn->exec_sql("select jrn_def_id,jrn_def_name from jrn_def ");
119for ($e=0;$e < Database::num_row($Res);$e++)
120{
122 $pdf->write_cell(40,6,$row['jrn_def_name']);
123 $priv=$SecUser->check_jrn($row['jrn_def_id']);
124 switch($priv)
125 {
126 case 'X':
127 $pdf->SetTextColor(255,0,34);
128 $pdf->write_cell(30,6,_("Pas d'accès"));
129 break;
130 case 'R':
131 $pdf->SetTextColor(54,233,0);
132 $pdf->write_cell(30,6,_("Lecture"));
133 break;
134 case 'O':
135 /**
136 *non implemented
137 */
138 $pdf->write_cell(30,6,_("Opérations prédéfinies uniquement"));
139 break;
140 case 'W':
141 $pdf->SetTextColor(54,233,0);
142 $pdf->write_cell(30,6,_('Ecriture'));
143 break;
144 }
145 $pdf->SetTextColor(0);
146 $pdf->line_new();
147}
148
149//-----------------------------------------------------
150// Follow_Up
151$pdf->SetFont('DejaVu','B',9);
152$pdf->write_cell(0,7,_('Accès action'),1,0,'C');
153$pdf->line_new();
154$pdf->SetFont('DejaVu','',6);
155$Res=$cn->exec_sql(
156 "select ac_id, ac_description from action order by ac_description ");
157
159
160for ( $i =0 ; $i < $Max; $i++ )
161{
163 $pdf->write_cell(90,6,$l_line['ac_description']);
164 $right=$SecUser->check_action($l_line['ac_id']);
165 switch ($right)
166 {
167 case 0:
168 $pdf->SetTextColor(255,0,34);
169
170 $pdf->write_cell(30,6,_("Pas d'accès"));
171 break;
172 case 1:
173 case 2:
174 $pdf->SetTextColor(54,233,0);
175 $pdf->write_cell(30,6,_("Accès"));
176 break;
177 }
178 $pdf->SetTextColor(0);
179
180 $pdf->line_new();
181}
182$fDate=date('dmy-HI');
183$pdf->Output('security-'.$fDate.'.pdf','D');
184?>
$from_poste name
$input_from id
Definition: balance.inc.php:63
static fetch_array($ret, $p_indice=0, $p_mode=PGSQL_ASSOC)
wrapper for the function pg_fetch_array
static num_row($ret)
wrapper for the function pg_num_rows
contains the class for connecting to Noalyss
static connect()
manage the http input (get , post, request) and extract from an array
API for creating PDF, unicode, based on tfpdf.
Definition: pdf.class.php:34
for( $i=0 ; $i< $Max; $i++) $fDate
if($access=='L') elseif($access=='R') elseif( $access=='P') if( $SecUser->admin==1) $pdf
catch(Exception $exc) $rep
$str
Definition: fiche.inc.php:91
if( $delta< 0) elseif( $delta==0)
$priv
Definition: user_login.php:128