file:///home/developper/svn/phpcompta/tags/rel600 ........ r4728 | danydb | 2012-01-23 10:50:01 +0100 (Mon, 23 Jan 2012) | 2 lines Renamed ........ r4729 | danydb | 2012-01-24 13:42:20 +0100 (Tue, 24 Jan 2012) | 2 lines Bug 517 : impossible d'effacer un utilisateur ........ r4730 | danydb | 2012-01-24 13:49:31 +0100 (Tue, 24 Jan 2012) | 2 lines typo ........ r4731 | danydb | 2012-01-25 00:42:14 +0100 (Wed, 25 Jan 2012) | 1 line probleme mise à jour fiche avec double poste comptable ........ r4732 | danydb | 2012-01-25 00:44:06 +0100 (Wed, 25 Jan 2012) | 1 line Esthetique : document généré ........ r4733 | danydb | 2012-01-25 00:56:11 +0100 (Wed, 25 Jan 2012) | 1 line Problème ajout ligne dans VEN / ACH si non assujetti TVA ........ r4734 | danydb | 2012-01-25 01:46:43 +0100 (Wed, 25 Jan 2012) | 1 line order in user ........
245 lines
6.3 KiB
PHP
245 lines
6.3 KiB
PHP
<?php
|
|
/*
|
|
* This file is part of PhpCompta.
|
|
*
|
|
* PhpCompta is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* PhpCompta is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with PhpCompta; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*/
|
|
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
|
|
/* ! \file
|
|
* \brief Users Security
|
|
*/
|
|
include_once("ac_common.php");
|
|
require_once('class_database.php');
|
|
include_once("user_menu.php");
|
|
include_once ("class_user.php");
|
|
|
|
$rep = new Database();
|
|
|
|
if (!isset($_REQUEST['use_id']))
|
|
{
|
|
html_page_stop();
|
|
exit();
|
|
}
|
|
$uid = $_REQUEST['use_id'];
|
|
$UserChange = new User($rep, $uid);
|
|
|
|
if ($UserChange->id == false)
|
|
{
|
|
// Message d'erreur
|
|
html_page_stop();
|
|
}
|
|
|
|
/* Save the changes */
|
|
if (isset($_POST['SAVE']))
|
|
{
|
|
$uid = $_POST['UID'];
|
|
|
|
// Update User
|
|
$cn = new Database();
|
|
$UserChange = new User($cn, $uid);
|
|
if ($UserChange->load() == -1)
|
|
{
|
|
alert("Cet utilisateur n'existe pas");
|
|
}
|
|
else
|
|
{
|
|
$UserChange->first_name = $_POST['fname'];
|
|
$UserChange->last_name = $_POST['lname'];
|
|
$UserChange->active = $_POST['Actif'];
|
|
$UserChange->admin = $_POST['Admin'];
|
|
if ( trim($_POST['password'])<>'')
|
|
{
|
|
$UserChange->pass = md5($_POST['password']);
|
|
} else
|
|
{
|
|
$UserChange->pass=$UserChange->password;
|
|
}
|
|
$UserChange->save();
|
|
|
|
// Update Priv on Folder
|
|
foreach ($_POST as $name => $elem)
|
|
{
|
|
if (substr_count($name, 'PRIV') != 0)
|
|
{
|
|
$db_id = substr($name, 4);
|
|
$cn = new Database();
|
|
$UserChange->set_folder_access($db_id, $elem);
|
|
Dossier::synchro_admin($db_id);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (isset($_POST["DELETE"]))
|
|
{
|
|
$cn = new Database();
|
|
$Res = $cn->exec_sql("delete from priv_user where priv_jnt in ( select jnt_id from jnt_use_dos where use_id=$1)", array($uid));
|
|
$Res = $cn->exec_sql("delete from jnt_use_dos where use_id=$1", array($uid));
|
|
$Res = $cn->exec_sql("delete from ac_users where use_id=$1", array($uid));
|
|
|
|
echo "<center><H2 class=\"info\"> User " . h($_POST['fname']) . " " . h($_POST['lname']) . " est effacé</H2></CENTER>";
|
|
require_once("class_iselect.php");
|
|
require_once("user.inc.php");
|
|
return;
|
|
}
|
|
}
|
|
$UserChange->load();
|
|
$it_pass=new IText('password');
|
|
$it_pass->value="";
|
|
?>
|
|
<h1 class="info">Modification</h1>
|
|
<? echo HtmlInput::button_anchor('Retour', 'admin_repo.php?action=user_mgt'); ?>
|
|
<FORM METHOD="POST">
|
|
|
|
<?=HtmlInput::hidden('UID',$uid)?>
|
|
<TABLE BORDER=0>
|
|
<TR>
|
|
|
|
<?php printf('<td>login</td><td> %s</td>', $UserChange->login); ?>
|
|
</TD>
|
|
</tr>
|
|
<TR>
|
|
<TD>
|
|
<?php printf('Nom de famille </TD><td><INPUT class="input_text" type="text" NAME="lname" value="%s"> ', $UserChange->name); ?>
|
|
</TD>
|
|
</TR>
|
|
<TR>
|
|
<?php printf('<td>prénom</td><td>
|
|
<INPUT class="input_text" type="text" NAME="fname" value="%s"> ', $UserChange->first_name);
|
|
?>
|
|
</TD>
|
|
</TR>
|
|
<tr>
|
|
<td>
|
|
Mot de passe :<span class="info">Laisser à VIDE pour ne PAS le changer</span>
|
|
</td>
|
|
<td>
|
|
<?=$it_pass->input();?>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<TABLE>
|
|
<?php
|
|
if ($UserChange->active == 1)
|
|
{
|
|
$ACT = "CHECKED";
|
|
$NACT = "UNCHECKED";
|
|
}
|
|
else
|
|
{
|
|
$ACT = "UNCHECKED";
|
|
$NACT = "CHECKED";
|
|
}
|
|
echo "<TR><TD>";
|
|
printf('<INPUT type="RADIO" NAME="Actif" VALUE="1" %s> Actif', $ACT);
|
|
echo "</TD><TD>";
|
|
printf('<INPUT type="RADIO" NAME="Actif" VALUE="0" %s> Non Actif', $NACT);
|
|
echo "</TD></TR>";
|
|
?>
|
|
</TABLE>
|
|
</TD>
|
|
<TD>
|
|
<TABLE>
|
|
<?php
|
|
if ($UserChange->admin == 1)
|
|
{
|
|
$ACT = "CHECKED";
|
|
$NACT = "UNCHECKED";
|
|
}
|
|
else
|
|
{
|
|
$ACT = "UNCHECKED";
|
|
$NACT = "CHECKED";
|
|
}
|
|
echo "<TR><TD>";
|
|
printf('<INPUT type="RADIO" NAME="Admin" VALUE="1" %s> Administrateur global', $ACT);
|
|
echo "</TD><TD>";
|
|
printf('<INPUT type="RADIO" NAME="Admin" VALUE="0" %s> Pas administrateur global ', $NACT);
|
|
echo "</TD></TR>";
|
|
?>
|
|
</TABLE>
|
|
</TD>
|
|
</TR>
|
|
<TR>
|
|
<TD>
|
|
<!-- Show all database and rights -->
|
|
<H2 class="info"> Droit sur les dossiers pour les utilisateurs normaux </H2>
|
|
<p class="notice">
|
|
Les autres droits doivent être réglés dans les dossiers (paramètre->sécurité), le fait de changer un utilisateur d'administrateur à utilisateur
|
|
normal ne change pas le profil administrateur dans les dossiers.
|
|
Il faut aller dans CFGSECURITY pour diminuer ses privilèges.
|
|
</p>
|
|
<TABLE>
|
|
<?php
|
|
$array = array(
|
|
array('value' => 'X', 'label' => 'Aucun Accès'),
|
|
array('value' => 'R', 'label' => 'Utilisateur normal')
|
|
);
|
|
$repo = new Dossier(0);
|
|
|
|
$Dossier = $repo->show_dossier('all', 1, 0);
|
|
if (empty($Dossier))
|
|
{
|
|
echo hb('* Aucun Dossier *');
|
|
echo '</div>';
|
|
exit();
|
|
}
|
|
|
|
$mod_user = new User(new Database(), $uid);
|
|
foreach ($Dossier as $rDossier)
|
|
{
|
|
|
|
$priv = $mod_user->get_folder_access($rDossier['dos_id']);
|
|
printf("<TR><TD> Dossier : %s </TD>", h($rDossier['dos_name']));
|
|
|
|
$select = new ISelect();
|
|
$select->table = 1;
|
|
$select->name = sprintf('PRIV%s', $rDossier['dos_id']);
|
|
$select->value = $array;
|
|
$select->selected = $priv;
|
|
echo $select->input();
|
|
echo "</TD></TR>";
|
|
}
|
|
?>
|
|
</TABLE>
|
|
|
|
|
|
|
|
|
|
|
|
<input type="Submit" class="button" NAME="SAVE" VALUE="Sauver les changements" onclick="return confirm('Confirmer changement ?');">
|
|
|
|
<input type="Submit" class="button" NAME="DELETE" VALUE="Effacer" onclick="return confirm('Confirmer effacement ?');" >
|
|
<? echo HtmlInput::button_anchor('Retour', 'admin_repo.php?action=user_mgt'); ?>
|
|
</FORM>
|
|
|
|
</DIV>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<?php
|
|
html_page_stop();
|
|
?>
|
|
|
|
|