Amlioration gestion des modules de gnration de mot de passe

This commit is contained in:
Laurent Destailleur 2006-04-01 12:03:31 +00:00
parent bc8f2d8a71
commit a982502a33
9 changed files with 198 additions and 59 deletions

View File

@ -1,5 +1,26 @@
English Dolibarr changelog
Changelog for 2.0
***** Changelog for 2.1 compared to 2.0.1 *****
- Added an export tool to export main dolibarr data.
- Added product categories management.
- Graphical enhancements (picto to describe all status).
- New permissions (can restrict access for a commercial user to elements
of its companies only).
- Lot of fixes after 2.0 release not fixed in 2.0.1
- Little enhancements to OSCommerce module.
- Provide PDF generation for orders.
- Can make one payment for several supplier invoices.
***** Changelog for 2.0.1 compared to 2.0 *****
Minor bug fixes
***** Changelog for 2.0 compared to 1.0 *****
Changelog file size is so important, that it is not included inside Dolibarr
package. You can find it at dolibarrint.jexiste.fr

View File

@ -37,9 +37,9 @@ if (!$user->admin) accessforbidden();
/*
* Actions
*/
if ($_POST["action"] == 'update' || $_POST["action"] == 'add')
if ($_GET["action"] == 'setgeneraterule')
{
if (! dolibarr_set_const($db, $_POST["constname"],$_POST["constvalue"],$typeconst[$_POST["consttype"]],0,isset($_POST["constnote"])?$_POST["constnote"]:''))
if (! dolibarr_set_const($db, 'USER_PASSWORD_GENERATED',$_GET["value"]))
{
dolibarr_print_error($db);
}
@ -73,16 +73,7 @@ dolibarr_fiche_head($head, $hselected, $langs->trans("Security"));
$var=false;
$form = new Form($db);
$typeconst=array('yesno','texte','chaine');
print '<table class="noborder" width=\"100%\">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td>'.$langs->trans("Value").'</td>';
//print '<td>'.$langs->trans("Example").'</td>';
print "</tr>\n";
// Choix du gestionnaire du générateur de mot de passe
@ -91,34 +82,66 @@ print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="constname" value="USER_PASSWORD_GENERATED">';
print '<input type="hidden" name="consttype" value="yesno">';
print '<tr '.$bc[$var].'><td>'.$langs->trans("RuleForGeneratedPasswords").'</td>';
print '<td>';
// Charge tableau des modules generation
$dir = "../includes/modules/security/generate";
clearstatcache();
$handle=opendir($dir);
$arrayhandler=array('0'=>$langs->trans("DoNotSuggest"));
$i=1;
while (($file = readdir($handle))!==false)
{
if (eregi('modGeneratePass([a-z]+).class.php',$file,$reg))
if (eregi('(modGeneratePass[a-z]+).class.php',$file,$reg))
{
$arrayhandler[strtolower($reg[1])]=$reg[1];
// Chargement de la classe de numérotation
$classname = $reg[1];
require_once($dir.'/'.$file);
$obj = new $classname($db,$conf,$langs,$user);
$arrayhandler[$obj->id]=$obj;
$i++;
}
}
$form->select_array('constvalue',$arrayhandler,$conf->global->USER_PASSWORD_GENERATED);
print "</td>";
//print "<td>".."</td>";
print "</tr>\n";
closedir($handle);
print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></td></tr>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("RuleForGeneratedPasswords").'</td>';
print '<td>'.$langs->trans("Example").'</td>';
print '<td>&nbsp;</td>';
print '</tr>';
foreach ($arrayhandler as $key => $module)
{
$var = !$var;
print '<tr '.$bc[$var].'><td width="100">';
print ucfirst($key);
print "</td><td>\n";
print $arrayhandler[$key]->getDescription();
print '</td>';
// Affiche example
print '<td width="60">'.$module->getExample().'</td>';
print '<td width="50" align="center">';
if ($conf->global->USER_PASSWORD_GENERATED == $key)
{
$title='';
print img_tick($title);
}
else
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=setgeneraterule&amp;value='.$key.'">'.$langs->trans("Activate").'</a>';
}
print "</td></tr>\n";
}
print '</table>';
//print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></td></tr>';
print '</form>';
print "</table>\n";
print '</div>';
llxFooter('$Date$ - $Revision$');

View File

@ -0,0 +1,87 @@
<?php
/* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program 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.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* or see http://www.gnu.org/
*
* $Id$
* $Source$
*/
/**
\file htdocs/includes/modules/security/generate/modGeneratePassNone.class.php
\ingroup core
\brief Fichier de gestion de la generation de mot de passe selon règle standard
*/
class modGeneratePassNone
{
var $id;
var $length;
var $db;
var $conf;
var $lang;
var $user;
/**
* \brief Constructeur
* \param db Handler d'accès base
* \param conf Handler de conf
* \param lang Handler de langue
* \param user Handler du user connecté
*/
function modGeneratePassNone($db, $conf, $langs, $user)
{
$this->id = "none";
$this->length = 0;
$this->db=$db;
$this->conf=$conf;
$this->langs=$langs;
$this->user=$user;
}
/**
* \brief Renvoi la description du module
* \return string Texte descripif
*/
function getDescription()
{
return "Ne propose pas de mots de passe générés. Le mot de passe est à saisir manuellement.";
}
/**
* \brief Renvoie exemple de mot de passe généré par cette règle
* \return string Exemple
*/
function getExample()
{
return $this->langs->trans("None");
}
/**
* \brief Génère le mot de passe
* \return string Renvoi mot de passe généré
*/
function getNewGeneratedPassword()
{
return "";
}
}
?>

View File

@ -21,12 +21,12 @@
*/
/**
\file htdocs/includes/modules/security/generate/modGeneratePassDefault.class.php
\file htdocs/includes/modules/security/generate/modGeneratePassStandard.class.php
\ingroup core
\brief Fichier de gestion de la generation de mot de passe selon règle standard
*/
class modGeneratePassDefault
class modGeneratePassStandard
{
var $id;
var $length;
@ -44,9 +44,9 @@ class modGeneratePassDefault
* \param lang Handler de langue
* \param user Handler du user connecté
*/
function modGeneratePassDefault($db, $conf, $langs, $user)
function modGeneratePassStandard($db, $conf, $langs, $user)
{
$this->id = "default";
$this->id = "standard";
$this->length = 8;
$this->db=$db;

View File

@ -6,7 +6,7 @@ NoContactCard=No card among contacts
Permission=Permission
Permissions=Permissions
SendNewPassword=Send new password
ReinitPassword=Initialize new password
ReinitPassword=Generate new password
PasswordChangedTo=Password changed to: %s
SubjectNewPassword=Your new password for Dolibarr
AvailableRights=Available permissions
@ -26,8 +26,8 @@ ConfirmDisableUser=Are you sure you want to disable user %s ?
ConfirmDisableGroup=Are you sure you want to disable group %s ?
ConfirmDeleteUser=Are you sure you want to delete user %s ?
ConfirmDeleteGroup=Are you sure you want to delete group %s ?
ConfirmReinitPassword=Are you sure you want to reinitialize password for user %s ?
ConfirmSendNewPassword=Are you sure you want to reinitialize and send new password for user %s ?
ConfirmReinitPassword=Are you sure you want to generate a new password for user %s ?
ConfirmSendNewPassword=Are you sure you want to generate and send new password for user %s ?
NewUser=New user
CreateUser=Create user
SearchAGroup=Search a group

View File

@ -6,7 +6,7 @@ NoContactCard=Pas de fiche parmi les contacts
Permission=Droit
Permissions=Droits
SendNewPassword=Envoyer nouveau mot de passe
ReinitPassword=Réinitialiser mot de passe
ReinitPassword=Générer nouveau mot de passe
PasswordChangedTo=Mot de passe modifié en: %s
SubjectNewPassword=Votre mot de passe pour Dolibarr
AvailableRights=Permissions disponibles
@ -26,8 +26,8 @@ ConfirmDisableUser=
ConfirmDisableGroup=Êtes-vous sûr de vouloir désactiver le groupe %s ?
ConfirmDeleteUser=Êtes-vous sûr de vouloir supprimer l'utilisateur %s ?
ConfirmDeleteGroup=Êtes-vous sûr de vouloir supprimer le groupe %s ?
ConfirmReinitPassword=Êtes-vous sûr de vouloir réinitialiser le mot de passe de l'utilisateur %s ?
ConfirmSendNewPassword=Êtes-vous sûr de vouloir réinitialiser et envoyer un nouveau mot de passe pour l'utilisateur %s ?
ConfirmReinitPassword=Êtes-vous sûr de vouloir générer un nouveau mot de passe pour l'utilisateur %s ?
ConfirmSendNewPassword=Êtes-vous sûr de vouloir générer et envoyer un nouveau mot de passe pour l'utilisateur %s ?
NewUser=Nouvel utilisateur
CreateUser=Créer l'utilisateur
SearchAGroup=Rechercher un groupe

View File

@ -351,6 +351,8 @@ if (! $conf->global->SOCIETE_CODECOMPTA_ADDON) $conf->global->SOCIETE_CODECOMPTA
if ($conf->global->CODECLIENT_ADDON) $conf->global->SOCIETE_CODECLIENT_ADDON=$conf->global->CODECLIENT_ADDON;
if ($conf->global->CODEFOURNISSEUR_ADDON) $conf->global->SOCIETE_CODEFOURNISSEUR_ADDON=$conf->global->CODEFOURNISSEUR_ADDON;
// securite
if (! $conf->global->USER_PASSWORD_GENERATED) $conf->global->USER_PASSWORD_GENERATED='standard';
// conf->use_preview_tabs
$conf->use_preview_tabs=1;

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -33,6 +33,11 @@ $langs->load("users");
$form = new Form($db);
/*
* Actions
*/
if ($_POST["action"] == 'update')
{
$edituser = new User($db, $_GET["id"]);
@ -44,16 +49,13 @@ if ($_POST["action"] == 'update')
$edituser->update_clicktodial();
Header("Location: clicktodial.php?id=".$_GET["id"]);
exit;
}
llxHeader("","Addon Utilisateur");
/* ************************************************************************** */
/* */
/* Nouvel utilisateur */
/* */
/* ************************************************************************** */
llxHeader("","ClickToDial");
if ($_GET["id"])
@ -101,8 +103,8 @@ if ($_GET["id"])
dolibarr_fiche_head($head, $hselected, $langs->trans("User").": ".$fuser->fullname);
/*
* Fiche en mode visu
*/
* Fiche en mode visu
*/
print '<table class="border" width="100%">';
@ -124,7 +126,7 @@ if ($_GET["id"])
if ($_GET["action"] == 'edit')
{
print '<form action="clicktodial.php?id='.$_GET["id"].'" method="post">';
print '<input type="hidden" name="action" value="update"></td>';
print '<input type="hidden" name="action" value="update">';
print '<table class="border" width="100%">';
print "<tr>".'<td width="25%" valign="top">'.$langs->trans("Login").'</td>';
print '<td width="25%" class="valeur">';
@ -140,10 +142,11 @@ if ($_GET["id"])
print '<input name="poste" value="'.$fuser->clicktodial_poste.'"></td>';
print '<td width="25%" valign="top">&nbsp;</td>';
print '<td width="25%" valign="top">&nbsp;</td>';
print "</tr>\n";
print '</table><input type="submit"</form>';
print '<tr><td colspan="4" align="center"><input class="button" type="submit"></td></tr>';
print '</table></form>';
}
else
{
@ -164,7 +167,6 @@ if ($_GET["id"])
print "</tr></table>\n";
}
print "<br>\n";
print "</div>\n";
/*

View File

@ -586,15 +586,19 @@ else
print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&amp;action=edit">'.$langs->trans("Edit").'</a>';
}
if (($user->id != $_GET["id"] && $caneditpassword) && $fuser->login)
{
print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&amp;action=password">'.$langs->trans("ReinitPassword").'</a>';
}
if (($user->id != $_GET["id"] && $caneditpassword) && $fuser->email && $fuser->login)
{
print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&amp;action=passwordsend">'.$langs->trans("SendNewPassword").'</a>';
}
// Si on a un gestionnaire de generation de mot de passe actif
if ($conf->global->USER_PASSWORD_GENERATED != 'none')
{
if (($user->id != $_GET["id"] && $caneditpassword) && $fuser->login)
{
print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&amp;action=password">'.$langs->trans("ReinitPassword").'</a>';
}
if (($user->id != $_GET["id"] && $caneditpassword) && $fuser->email && $fuser->login)
{
print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&amp;action=passwordsend">'.$langs->trans("SendNewPassword").'</a>';
}
}
if ($user->id <> $_GET["id"] && $candisableperms && $fuser->login)
{