From a982502a33bd8bf4cf5e562e9cb4d1d25986eb97 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Apr 2006 12:03:31 +0000 Subject: [PATCH] =?UTF-8?q?Am=E9lioration=20gestion=20des=20modules=20de?= =?UTF-8?q?=20g=E9n=E9ration=20de=20mot=20de=20passe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChangeLog | 23 ++++- htdocs/admin/security.php | 73 ++++++++++------ .../generate/modGeneratePassNone.class.php | 87 +++++++++++++++++++ ....php => modGeneratePassStandard.class.php} | 8 +- htdocs/langs/en_US/users.lang | 6 +- htdocs/langs/fr_FR/users.lang | 6 +- htdocs/master.inc.php | 2 + htdocs/user/clicktodial.php | 30 ++++--- htdocs/user/fiche.php | 22 +++-- 9 files changed, 198 insertions(+), 59 deletions(-) create mode 100644 htdocs/includes/modules/security/generate/modGeneratePassNone.class.php rename htdocs/includes/modules/security/generate/{modGeneratePassDefault.class.php => modGeneratePassStandard.class.php} (94%) diff --git a/ChangeLog b/ChangeLog index 198735497b7..ce316a025af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index 185b6b71f85..8b64b1b5d2e 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -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 ''; -print ''; -print ''; -print ''; -//print ''; -print "\n"; // Choix du gestionnaire du générateur de mot de passe @@ -91,34 +82,66 @@ print ''; print ''; print ''; -print ''; - -print '"; -//print ""; -print "\n"; +closedir($handle); -print ''; +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").''.$langs->trans("Example").'
'.$langs->trans("RuleForGeneratedPasswords").''; - +// 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 "".."
'; +print ''; +print ''; +print ''; +print ''; +print ''; + +foreach ($arrayhandler as $key => $module) +{ + $var = !$var; + print ''; + + // Affiche example + print ''; + + print '\n"; +} + +print '
'.$langs->trans("RuleForGeneratedPasswords").''.$langs->trans("Example").' 
'; + print ucfirst($key); + print "\n"; + print $arrayhandler[$key]->getDescription(); + print ''.$module->getExample().''; + if ($conf->global->USER_PASSWORD_GENERATED == $key) + { + $title=''; + print img_tick($title); + } + else + { + print ''.$langs->trans("Activate").''; + } + print "
'; + + +//print ''; print ''; -print "\n"; - print ''; llxFooter('$Date$ - $Revision$'); diff --git a/htdocs/includes/modules/security/generate/modGeneratePassNone.class.php b/htdocs/includes/modules/security/generate/modGeneratePassNone.class.php new file mode 100644 index 00000000000..5e3ae0ce0b1 --- /dev/null +++ b/htdocs/includes/modules/security/generate/modGeneratePassNone.class.php @@ -0,0 +1,87 @@ + + * + * 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 ""; + } + +} + +?> diff --git a/htdocs/includes/modules/security/generate/modGeneratePassDefault.class.php b/htdocs/includes/modules/security/generate/modGeneratePassStandard.class.php similarity index 94% rename from htdocs/includes/modules/security/generate/modGeneratePassDefault.class.php rename to htdocs/includes/modules/security/generate/modGeneratePassStandard.class.php index b91524b2cb9..09264ceb781 100644 --- a/htdocs/includes/modules/security/generate/modGeneratePassDefault.class.php +++ b/htdocs/includes/modules/security/generate/modGeneratePassStandard.class.php @@ -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; diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index d7d4f1b4576..52bd08810de 100755 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -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 diff --git a/htdocs/langs/fr_FR/users.lang b/htdocs/langs/fr_FR/users.lang index e208159659b..08f5d2a3c1c 100755 --- a/htdocs/langs/fr_FR/users.lang +++ b/htdocs/langs/fr_FR/users.lang @@ -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 diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 303ad8e495b..4022c5e0887 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -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; diff --git a/htdocs/user/clicktodial.php b/htdocs/user/clicktodial.php index 8385dd374bc..4a9e43eb490 100644 --- a/htdocs/user/clicktodial.php +++ b/htdocs/user/clicktodial.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005 Laurent Destailleur +/* Copyright (C) 2005 Rodolphe Quiedeville + * Copyright (C) 2005-2006 Laurent Destailleur * * 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 ''; @@ -124,7 +126,7 @@ if ($_GET["id"]) if ($_GET["action"] == 'edit') { print ''; - print ''; + print ''; print '
'; print "".''; print ''; print ''; print ''; - print "\n"; - print '
'.$langs->trans("Login").''; @@ -140,10 +142,11 @@ if ($_GET["id"]) print '  
'; + print ''; + + print ''; } else { @@ -164,7 +167,6 @@ if ($_GET["id"]) print "\n"; } - print "
\n"; print "\n"; /* diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 546501fcce5..ae03e0da965 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -586,15 +586,19 @@ else print ''.$langs->trans("Edit").''; } - if (($user->id != $_GET["id"] && $caneditpassword) && $fuser->login) - { - print ''.$langs->trans("ReinitPassword").''; - } - - if (($user->id != $_GET["id"] && $caneditpassword) && $fuser->email && $fuser->login) - { - print ''.$langs->trans("SendNewPassword").''; - } + // 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 ''.$langs->trans("ReinitPassword").''; + } + + if (($user->id != $_GET["id"] && $caneditpassword) && $fuser->email && $fuser->login) + { + print ''.$langs->trans("SendNewPassword").''; + } + } if ($user->id <> $_GET["id"] && $candisableperms && $fuser->login) {