noalyss Version-10
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
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 <tr>
121 <td>
122 <?php echo _('Double authentification');?>
123 </td>
124 <td>
125 <?php
126 $auth_method=new ISelect('auth_method');
127 $auth_method->value=array(
128 array('value'=>0,'label'=>_('Aucune')),
129 array('value'=>1,'label'=>_('Mot de passe et code par courriel (ou TOTP) ')),
130 array('value'=>2,'label'=>_('Mot de passe et TOTP')),
131 );
132 $auth_method->selected=$UserChange->authent_method;
133 echo $auth_method->input();
134 ?>
135 </td>
136 </tr>
137 <tr>
138 <td>
139 <?=_("Action Double Authentification")?>
140 </td>
141 <td>
142 <span style="display:block">
143 <input type="checkbox" name="generate_otp" value="1"><?=_("Renouveller clef secrète")?>
144 </span>
145 <span style="display:block">
146 <input type="checkbox" name="email_otp" value="1"><?=_("envoyer email pour 2FA avec OTP ")?>
147 <span class="text-muted"> <?=_("Un email sera envoyé avec un lien pour initialiser 2FA avec OTP")?>
148 </span>
149
150 </td>
151
152 </tr>
153
154 </table>
155
156 <input type="hidden" name="sbaction" id="sbaction" value="save">
157
158 <input type="Submit" class="button" NAME="SAVE" VALUE="<?=('Sauver les changements')?>" onclick="return confirm_box('user_detail_frm','<?=_('Confirmer')?>');">
159
160 <input type="button" class="button" NAME="DELETE" VALUE="<?=('Effacer')?>" onclick="$('delete_user_div').show();" >
161
162</FORM>
163<div id="delete_user_div" class="inner_box" style="display: none">
164<?=HtmlInput::title_box(_("Effacer"),'delete_user_div','hide')?>
165<FORM id="user_detail_frm" METHOD="POST">
166 <INPUT type="hidden" NAME="lname" value="<?="$UserChange->name"?>">
167 <INPUT type="hidden" NAME="fname" value="<?="$UserChange->first_name"?>">
168 <?php echo HtmlInput::hidden('UID',$uid)?>
169 <?php echo HtmlInput::hidden('use_id',$uid)?>
170 <input type="hidden" name="sbaction" value="delete">
171 <p class="info" id="codedel_div">
172 <?php
173 echo _("Pour effacer , confirmez en retapant le code, respectez les majuscules et minuscules");
174 echo confirm_with_string('userdel','5');
175 ?>
176
177 </p>
178 <ul class="aligned-block">
179 <li>
180 <input type="Submit" class="button" NAME="DELETE" VALUE="<?=_("Confirmer")?>">
181 </li>
182 <li>
183 <?=HtmlInput::button_hide('delete_user_div','button')?>
184 </li>
185 </ul>
186</FORM>
187</div>
188
189<?php
190if ($UserChange->admin == 0 ) :
191?>
192 <!-- Show all database and rights -->
193 <H2 class="h-section"> Accès aux dossiers</H2>
194 <p class="notice">
195 Les autres droits doivent être réglés dans les dossiers (paramètre->sécurité), le fait de changer un utilisateur d'administrateur à utilisateur
196 normal ne change pas le profil administrateur dans les dossiers.
197 Il faut aller dans C0SEC pour diminuer ses privilèges.
198 </p>
199
200<?php
201$array = array(
202 array('value' => 'X', 'label' => 'Aucun Accès'),
203 array('value' => 'R', 'label' => 'Utilisateur normal')
204);
205$repo = new Dossier(0);
206if ( $repo->count() == 0)
207{
208 echo hb('* Aucun Dossier *');
209 echo '</div>';
210 return;
211}
212
213$Dossier = $repo->show_dossier('R',$UserChange->login);
214
215$mod_user = new Noalyss_user(new Database(), $uid);
216?>
217 <TABLE id="database_list" class="result">
218<?php
219//
220// Display all the granted folders
221//
222$i=0;
223foreach ($Dossier as $rDossier):
224 $i++;
225$class=($i%2==0)?' even ':'odd ';
226?>
227 <tr id="row<?php echo $rDossier['dos_id']?>" class="<?php echo $class;?>">
228 <td>
229 <?php echo h($rDossier['dos_name']); ?>
230 </td>
231 <td>
232 <?php echo h($rDossier['dos_description']); ?>
233 </td>
234 <td>
235 <?php echo HtmlInput::anchor(_('Enleve'),"",
236 " onclick=\"folder_remove({$mod_user->id},{$rDossier['dos_id']});\"");?>
237 </td>
238
239 </tr>
240<?php
241endforeach;
242?>
243 </TABLE>
244 <?php
245 echo HtmlInput::button("database_add_button",_('Ajout'),
246 " onclick=\"folder_display({$mod_user->id});\"");
247 ?>
248 <?php
249 // If UserChange->admin==1 it means he can access all databases
250 //
251 else :
252 ?>
253
254<?php
255 endif;
256?>
257
258</DIV>
259
260<?php
261html_page_stop();
262?>
263
264
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...
span($p_string, $p_extra='')
Definition ac_common.php:43
html_page_stop()
end tag
p($p_string, $p_extra='')
Definition ac_common.php:39
echo_error($p_log, $p_line="", $p_message="")
log error into the /tmp/noalyss_error.log it doesn't work on windows
tr($p_string, $p_extra='')
Definition ac_common.php:88
td($p_string='', $p_extra='')
surround the string with td
Definition ac_common.php:83
$ret label
$opd_description style
$from_poste name
_("actif, passif,charge,...")
$ex
$input_from type
contains the class for connecting to Noalyss
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 Text member :
$all table
$select_admin
catch(Exception $ex) $UserChange
$select_actif