noalyss Version-9
user_detail.inc.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 Author Dany De Bontridder danydb@aevalys.eu
20/** \file
21 * \brief Users Security
22 */
23if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
24require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
25require_once NOALYSS_INCLUDE.'/lib/user_menu.php';
27$rep = new Database();
28try {
29$uid = $http->request('use_id');
30} catch (Exception $ex) {
31 echo_error($ex->getMessage());
32 throw $ex;
33}
34$UserChange = new Noalyss_user($rep, $uid);
35
36if ($UserChange->id == false)
37{
38 // Message d'erreur
40}
41
42
43$UserChange->load();
44$it_pass=new IText('password');
45$it_pass->javascript='onkeyup="check_password_strength(\'password\',\'password_info\',1)"';
46$it_pass->value="";
47?>
48<FORM id="user_detail_frm" METHOD="POST">
49
50<?php echo HtmlInput::hidden('UID',$uid)?>
51<?php echo HtmlInput::hidden('use_id',$uid)?>
52 <TABLE BORDER=0>
53 <TR>
54
55<?php printf('<td>login</td><td> %s</td>', $UserChange->login); ?>
56 </TD>
57 </tr>
58 <TR>
59 <TD>
60 <?php printf('Nom de famille </TD><td><INPUT class="input_text" type="text" NAME="lname" value="%s"> ', $UserChange->name); ?>
61 </TD>
62 </TR>
63 <TR>
64 <?php printf('<td>prénom</td><td>
65 <INPUT class="input_text" type="text" NAME="fname" value="%s"> ', $UserChange->first_name);
66 ?>
67 </TD>
68 </TR>
69 <tr>
70 <td>
71 <?php
72 echo _('email');
73 ?>
74 </td>
75 <td>
76 <INPUT class="input_text" type="text" NAME="email" value="<?php echo $UserChange->email;?>">
77 </td>
78 </tr>
79 <tr>
80 <td>
81 Mot de passe :<span class="info">Laisser à VIDE pour ne PAS le changer</span>
82 </td>
83 <td>
84 <?php echo $it_pass->input();?>
85 <span id="password_info" style="background-color: rgba(255,160,122,0.58);color:orangered;position:absolute"></span>
86 </td>
87 </tr>
88 <tr>
89 <td>
90 <?php echo _('Actif');?>
91 </td>
92 <td>
93 <?php
94 $select_actif=new ISelect('Actif');
95 $select_actif->value=array(
96 array('value'=>0,'label'=>_('Non')),
97 array('value'=>1,'label'=>_('Oui'))
98 );
99 $select_actif->selected=$UserChange->active;
100 echo $select_actif->input();
101 ?>
102 </td>
103 </tr>
104 <tr>
105 <td>
106 <?php echo _('Type');?>
107 </td>
108 <td>
109 <?php
110 $select_admin=new ISelect('Admin');
111 $select_admin->value=array(
112 array('value'=>0,'label'=>_('Utilisateur normal')),
113 array('value'=>1,'label'=>_('Administrateur'))
114 );
115 $select_admin->selected=$UserChange->admin;
116 echo $select_admin->input();
117 ?>
118 </td>
119 </tr>
120 </table>
121
122 <input type="hidden" name="sbaction" id="sbaction" value="save">
123
124 <input type="Submit" class="button" NAME="SAVE" VALUE="<?=('Sauver les changements')?>" onclick="return confirm_box('user_detail_frm','<?=_('Confirmer')?>');">
125
126 <input type="button" class="button" NAME="DELETE" VALUE="<?=('Effacer')?>" onclick="$('delete_user_div').show();" >
127
128</FORM>
129<div id="delete_user_div" class="inner_box" style="display: none">
130<?=HtmlInput::title_box(_("Effacer"),'delete_user_div','hide')?>
131<FORM id="user_detail_frm" METHOD="POST">
132 <INPUT type="hidden" NAME="lname" value="<?=_("$UserChange->name")?>">
133 <INPUT type="hidden" NAME="fname" value="<?=_("$UserChange->first_name")?>">
134 <?php echo HtmlInput::hidden('UID',$uid)?>
135 <?php echo HtmlInput::hidden('use_id',$uid)?>
136 <input type="hidden" name="sbaction" value="delete">
137 <p class="info" id="codedel_div">
138 <?php
139 echo _("Pour effacer , confirmez en retapant le code");
140 echo confirm_with_string('userdel','5');
141 ?>
142
143 </p>
144 <ul class="aligned-block">
145 <li>
146 <input type="Submit" class="button" NAME="DELETE" VALUE="<?=_("Confirmer")?>">
147 </li>
148 <li>
149 <?=HtmlInput::button_hide('delete_user_div')?>
150 </li>
151 </ul>
152</FORM>
153</div>
154
155<?php
156if ($UserChange->admin == 0 ) :
157?>
158 <!-- Show all database and rights -->
159 <H2 class="info"> Accès aux dossiers</H2>
160 <p class="notice">
161 Les autres droits doivent être réglés dans les dossiers (paramètre->sécurité), le fait de changer un utilisateur d'administrateur à utilisateur
162 normal ne change pas le profil administrateur dans les dossiers.
163 Il faut aller dans CFGSECURITY pour diminuer ses privilèges.
164 </p>
165
166<?php
167$array = array(
168 array('value' => 'X', 'label' => 'Aucun Accès'),
169 array('value' => 'R', 'label' => 'Utilisateur normal')
170);
171$repo = new Dossier(0);
172if ( $repo->count() == 0)
173{
174 echo hb('* Aucun Dossier *');
175 echo '</div>';
176 return;
177}
178
179$Dossier = $repo->show_dossier('R',$UserChange->login);
180
181$mod_user = new Noalyss_user(new Database(), $uid);
182?>
183 <TABLE id="database_list" class="result">
184<?php
185//
186// Display all the granted folders
187//
188$i=0;
189foreach ($Dossier as $rDossier):
190 $i++;
191$class=($i%2==0)?' even ':'odd ';
192?>
193 <tr id="row<?php echo $rDossier['dos_id']?>" class="<?php echo $class;?>">
194 <td>
195 <?php echo h($rDossier['dos_name']); ?>
196 </td>
197 <td>
198 <?php echo h($rDossier['dos_description']); ?>
199 </td>
200 <td>
201 <?php echo HtmlInput::anchor(_('Enleve'),"",
202 " onclick=\"folder_remove({$mod_user->id},{$rDossier['dos_id']});\"");?>
203 </td>
204
205 </tr>
206<?php
207endforeach;
208?>
209 </TABLE>
210 <?php
211 echo HtmlInput::button("database_add_button",_('Ajout'),
212 " onclick=\"folder_display({$mod_user->id});\"");
213 ?>
214 <?php
215 // If UserChange->admin==1 it means he can access all databases
216 //
217 else :
218 ?>
219
220<?php
221 endif;
222?>
223
224</DIV>
225
226<?php
227html_page_stop();
228?>
229
230
confirm_with_string($p_ctl_name, $p_car)
generate a string of p_car character and a input text with name p_ctl_name work like a kind of captch...
Definition: ac_common.php:1444
span($p_string, $p_extra='')
Definition: ac_common.php:43
html_page_stop()
end tag
Definition: ac_common.php:468
echo_error($p_log, $p_line="", $p_message="")
log error into the /tmp/noalyss_error.log it doesn't work on windows
Definition: ac_common.php:169
tr($p_string, $p_extra='')
Definition: ac_common.php:88
p($p_string)
Definition: ac_common.php:39
td($p_string='', $p_extra='')
surround the string with td
Definition: ac_common.php:83
$ret label
$opd_description style
$from_poste name
$ex
Definition: balance.inc.php:45
$input_from type
Definition: balance.inc.php:65
contains the class for connecting to Noalyss
manage the current dossier, everywhere we need to know to which folder we are connected,...
static button_hide($div_name)
Hide the HTML popup.
static hidden($p_name, $p_value, $p_id="")
static title_box($p_name, $p_div, $p_mod="close", $p_js="", $p_draggable="n", $p_enlarge='n')
Title for boxes, you can customize the symbol thanks symbol with the mode "custom".
manage the http input (get , post, request) and extract from an array
Html Input , create a tag <SELECT> ... </SELECT> if readonly == true then display the label correspon...
Html Input.
Definition: itext.class.php:30
$all table
$it_pass value
$select_admin
catch(Exception $ex) $UserChange
$it_pass
$select_actif