New: Ajout des droits sur le module user.
Les modules "base" (requis) sont actifs par défaut (a l'install) et non désactivables.
This commit is contained in:
parent
0745c647fc
commit
3607852e56
@ -55,9 +55,10 @@ if ($_GET["action"] == 'reset' && $user->admin)
|
|||||||
|
|
||||||
|
|
||||||
/** \brief Active un module
|
/** \brief Active un module
|
||||||
\param value Nom du module a activer
|
\param value Nom du module a activer
|
||||||
|
\param withdeps Active/désactive aussi les dépendances
|
||||||
*/
|
*/
|
||||||
function Activate($value)
|
function Activate($value,$withdeps=1)
|
||||||
{
|
{
|
||||||
global $db, $modules, $langs;
|
global $db, $modules, $langs;
|
||||||
|
|
||||||
@ -67,7 +68,7 @@ function Activate($value)
|
|||||||
if ($modName)
|
if ($modName)
|
||||||
{
|
{
|
||||||
$file = $modName . ".class.php";
|
$file = $modName . ".class.php";
|
||||||
include_once("../includes/modules/$file");
|
include_once(DOL_DOCUMENT_ROOT."/includes/modules/$file");
|
||||||
$objMod = new $modName($db);
|
$objMod = new $modName($db);
|
||||||
|
|
||||||
// Test si version PHP ok
|
// Test si version PHP ok
|
||||||
@ -81,18 +82,21 @@ function Activate($value)
|
|||||||
$objMod->init();
|
$objMod->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Activation des modules dont le module dépend
|
if ($withdeps)
|
||||||
for ($i = 0; $i < sizeof($objMod->depends); $i++)
|
|
||||||
{
|
{
|
||||||
Activate($objMod->depends[$i]);
|
// Activation des modules dont le module dépend
|
||||||
|
for ($i = 0; $i < sizeof($objMod->depends); $i++)
|
||||||
|
{
|
||||||
|
Activate($objMod->depends[$i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Desactivation des modules qui entrent en conflit
|
||||||
|
for ($i = 0; $i < sizeof($objMod->conflictwith); $i++)
|
||||||
|
{
|
||||||
|
UnActivate($objMod->conflictwith[$i],0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Desactivation des modules qui entrent en conflit
|
|
||||||
for ($i = 0; $i < sizeof($objMod->conflictwith); $i++)
|
|
||||||
{
|
|
||||||
UnActivate($objMod->conflictwith[$i],0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +115,7 @@ function UnActivate($value,$requiredby=1)
|
|||||||
if ($modName)
|
if ($modName)
|
||||||
{
|
{
|
||||||
$file = $modName . ".class.php";
|
$file = $modName . ".class.php";
|
||||||
include_once("../includes/modules/$file");
|
include_once(DOL_DOCUMENT_ROOT."/includes/modules/$file");
|
||||||
$objMod = new $modName($db);
|
$objMod = new $modName($db);
|
||||||
$objMod->remove();
|
$objMod->remove();
|
||||||
}
|
}
|
||||||
@ -181,6 +185,7 @@ print "</tr>\n";
|
|||||||
|
|
||||||
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/";
|
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/";
|
||||||
|
|
||||||
|
// Charge tableaux modules, nom, numero, orders depuis répertoire dir
|
||||||
$handle=opendir($dir);
|
$handle=opendir($dir);
|
||||||
$modules = array();
|
$modules = array();
|
||||||
$orders = array();
|
$orders = array();
|
||||||
@ -209,7 +214,6 @@ while (($file = readdir($handle))!==false)
|
|||||||
$modules[$i] = $objMod;
|
$modules[$i] = $objMod;
|
||||||
|
|
||||||
$nom[$i] = $modName;
|
$nom[$i] = $modName;
|
||||||
$numero[$i] = $j;
|
|
||||||
$orders[$i] = "$objMod->family"."_".$j; // Tri par famille puis numero module
|
$orders[$i] = "$objMod->family"."_".$j; // Tri par famille puis numero module
|
||||||
$j++;
|
$j++;
|
||||||
$i++;
|
$i++;
|
||||||
@ -221,7 +225,7 @@ asort($orders);
|
|||||||
$var=True;
|
$var=True;
|
||||||
|
|
||||||
$familylib=array(
|
$familylib=array(
|
||||||
'base'=>$langs->trans("ModuleBase"),
|
'base'=>$langs->trans("ModuleFamilyBase"),
|
||||||
'crm'=>$langs->trans("ModuleFamilyCrm"),
|
'crm'=>$langs->trans("ModuleFamilyCrm"),
|
||||||
'products'=>$langs->trans("ModuleFamilyProducts"),
|
'products'=>$langs->trans("ModuleFamilyProducts"),
|
||||||
'hr'=>$langs->trans("ModuleFamilyHr"),
|
'hr'=>$langs->trans("ModuleFamilyHr"),
|
||||||
@ -295,8 +299,8 @@ foreach ($orders as $key => $value)
|
|||||||
if ($conf->global->$const_name == 1)
|
if ($conf->global->$const_name == 1)
|
||||||
{
|
{
|
||||||
// Module actif
|
// Module actif
|
||||||
print "<a href=\"modules.php?id=".$objMod->numero."&action=reset&value=" . $modName . "&spe=" . $_GET["spe"] . "\">" . $langs->trans("Disable") . "</a></td>\n";
|
if ($family == 'base') print $langs->trans("Required");
|
||||||
|
else print "<a href=\"modules.php?id=".$objMod->numero."&action=reset&value=" . $modName . "&spe=" . $_GET["spe"] . "\">" . $langs->trans("Disable") . "</a></td>\n";
|
||||||
|
|
||||||
if ($objMod->config_page_url)
|
if ($objMod->config_page_url)
|
||||||
{
|
{
|
||||||
@ -331,6 +335,11 @@ foreach ($orders as $key => $value)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if ($family == 'base')
|
||||||
|
{
|
||||||
|
// Ne devrait pas arriver.
|
||||||
|
}
|
||||||
|
|
||||||
// Module non actif
|
// Module non actif
|
||||||
print "<a href=\"modules.php?id=".$objMod->numero."&action=set&value=" . $modName . "&spe=" . $_GET["spe"] . "\">" . $langs->trans("Activate") . "</a></td>\n <td> </td>\n";
|
print "<a href=\"modules.php?id=".$objMod->numero."&action=set&value=" . $modName . "&spe=" . $_GET["spe"] . "\">" . $langs->trans("Activate") . "</a></td>\n <td> </td>\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/install/etape5.php
|
\file htdocs/install/etape5.php
|
||||||
\brief Page de fin d'installation
|
\brief Page de fin d'installation ou de migration
|
||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -40,6 +40,8 @@ $success=0;
|
|||||||
if (file_exists($conffile))
|
if (file_exists($conffile))
|
||||||
{
|
{
|
||||||
include($conffile);
|
include($conffile);
|
||||||
|
if (! isset($dolibarr_main_db_prefix) || ! $dolibarr_main_db_prefix) $dolibarr_main_db_prefix='llx_';
|
||||||
|
define('MAIN_DB_PREFIX',$dolibarr_main_db_prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -96,6 +98,13 @@ if ($_POST["action"] == "set" || $_POST["action"] == "upgrade")
|
|||||||
$db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name);
|
$db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name);
|
||||||
$ok = 0;
|
$ok = 0;
|
||||||
|
|
||||||
|
// Active module user
|
||||||
|
$modName='modUser';
|
||||||
|
$file = $modName . ".class.php";
|
||||||
|
include_once("../includes/modules/$file");
|
||||||
|
$objMod = new $modName($db);
|
||||||
|
$objMod->init();
|
||||||
|
|
||||||
// If first install
|
// If first install
|
||||||
if ($_POST["action"] == "set")
|
if ($_POST["action"] == "set")
|
||||||
{
|
{
|
||||||
|
|||||||
@ -52,6 +52,8 @@ pHeader($langs->trans("MigrateScript"),"etape5","upgrade");
|
|||||||
if (file_exists($conffile))
|
if (file_exists($conffile))
|
||||||
{
|
{
|
||||||
include_once($conffile);
|
include_once($conffile);
|
||||||
|
if (! isset($dolibarr_main_db_prefix) || ! $dolibarr_main_db_prefix) $dolibarr_main_db_prefix='llx_';
|
||||||
|
define('MAIN_DB_PREFIX',$dolibarr_main_db_prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($dolibarr_main_db_type == "mysql")
|
if($dolibarr_main_db_type == "mysql")
|
||||||
|
|||||||
@ -42,6 +42,8 @@ ActiveOn=Activated on
|
|||||||
SourceFile=Source file
|
SourceFile=Source file
|
||||||
TriggersAvailable=Triggers available
|
TriggersAvailable=Triggers available
|
||||||
TriggersDesc=Triggers are components that modify, once activated, the behaviour of Dolibarr workflow. They add new actions, activated on Dolibarr events (new company creation, invoice validation, ...).
|
TriggersDesc=Triggers are components that modify, once activated, the behaviour of Dolibarr workflow. They add new actions, activated on Dolibarr events (new company creation, invoice validation, ...).
|
||||||
|
Required=Required
|
||||||
|
ModuleFamilyBase=System
|
||||||
ModuleFamilyCrm=Customer Ressource Management (CRM)
|
ModuleFamilyCrm=Customer Ressource Management (CRM)
|
||||||
ModuleFamilyProducts=Products Management
|
ModuleFamilyProducts=Products Management
|
||||||
ModuleFamilyHr=Human Ressource Management
|
ModuleFamilyHr=Human Ressource Management
|
||||||
@ -50,6 +52,8 @@ ModuleFamilyOther=Other
|
|||||||
ModuleFamilyTechnic=Technical Modules
|
ModuleFamilyTechnic=Technical Modules
|
||||||
ModuleFamilyExperimental=Experimental modules
|
ModuleFamilyExperimental=Experimental modules
|
||||||
ModuleFamilyFinancial=Financial Modules (Accountancy/Treasury)
|
ModuleFamilyFinancial=Financial Modules (Accountancy/Treasury)
|
||||||
|
Module0Name=Users & groups
|
||||||
|
Module0Desc=Users and groups management
|
||||||
Module1Name=Companies
|
Module1Name=Companies
|
||||||
Module1Desc=Companies and contacts' management
|
Module1Desc=Companies and contacts' management
|
||||||
Module2Name=Commercial
|
Module2Name=Commercial
|
||||||
@ -187,6 +191,12 @@ Permission229=Delete emailings
|
|||||||
Permission231=Read supplier invoices
|
Permission231=Read supplier invoices
|
||||||
Permission232=Create/modify supplier invoices
|
Permission232=Create/modify supplier invoices
|
||||||
Permission233=Delete supplier invoices
|
Permission233=Delete supplier invoices
|
||||||
|
Permission251=Read other users and groups
|
||||||
|
Permission252=Create/modify other users, their groups and permisssions
|
||||||
|
Permission253=Modify other users password
|
||||||
|
Permission254=Delete or disable other users
|
||||||
|
Permission255=Create/modify his own user informations
|
||||||
|
Permission256=Modify his own password
|
||||||
Permission300=Read bar codes
|
Permission300=Read bar codes
|
||||||
Permission301=Create/modify bar codes
|
Permission301=Create/modify bar codes
|
||||||
Permission302=Delete bar codes
|
Permission302=Delete bar codes
|
||||||
|
|||||||
@ -68,4 +68,5 @@ CreateDolibarrLogin=Create Dolibarr account
|
|||||||
LoginAccountDisable=Account disabled, put a new login to activate it.
|
LoginAccountDisable=Account disabled, put a new login to activate it.
|
||||||
UsePersonalValue=Use personal value
|
UsePersonalValue=Use personal value
|
||||||
ErrorFailedToSaveFile=Error - Failed to save file
|
ErrorFailedToSaveFile=Error - Failed to save file
|
||||||
GuiLanguage=Interface language
|
GuiLanguage=Interface language
|
||||||
|
InternalUser=Internal user
|
||||||
@ -42,6 +42,8 @@ ActiveOn=Active sur
|
|||||||
SourceFile=Fichier source
|
SourceFile=Fichier source
|
||||||
TriggersAvailable=Triggers disponibles
|
TriggersAvailable=Triggers disponibles
|
||||||
TriggersDesc=Les triggers sont des composants qui, une fois activés, modifient le comportement du workflow de Dolibarr. Ils réalisent des actions suplémentaires, déclenchées par les événements Dolibarr (création société, validation facture, clôture contrat...).
|
TriggersDesc=Les triggers sont des composants qui, une fois activés, modifient le comportement du workflow de Dolibarr. Ils réalisent des actions suplémentaires, déclenchées par les événements Dolibarr (création société, validation facture, clôture contrat...).
|
||||||
|
Required=Requis
|
||||||
|
ModuleFamilyBase=Système
|
||||||
ModuleFamilyCrm=Gestion client (CRM)
|
ModuleFamilyCrm=Gestion client (CRM)
|
||||||
ModuleFamilyProducts=Gestion produits
|
ModuleFamilyProducts=Gestion produits
|
||||||
ModuleFamilyHr=Ressources humaines
|
ModuleFamilyHr=Ressources humaines
|
||||||
@ -50,6 +52,8 @@ ModuleFamilyOther=Autre
|
|||||||
ModuleFamilyTechnic=Modules techniques, interfaces
|
ModuleFamilyTechnic=Modules techniques, interfaces
|
||||||
ModuleFamilyExperimental=Modules expérimentaux (ne pas utiliser en production)
|
ModuleFamilyExperimental=Modules expérimentaux (ne pas utiliser en production)
|
||||||
ModuleFamilyFinancial=Modules financiers (Compta/trésorerie)
|
ModuleFamilyFinancial=Modules financiers (Compta/trésorerie)
|
||||||
|
Module0Name=Utilisateurs & groupes
|
||||||
|
Module0Desc=Gestion des utilisateurs et groupes
|
||||||
Module1Name=Sociétés
|
Module1Name=Sociétés
|
||||||
Module1Desc=Gestion des sociétés et contacts
|
Module1Desc=Gestion des sociétés et contacts
|
||||||
Module2Name=Commercial
|
Module2Name=Commercial
|
||||||
@ -187,6 +191,12 @@ Permission229=Supprimer les mailings
|
|||||||
Permission231=Consulter les factures fournisseurs
|
Permission231=Consulter les factures fournisseurs
|
||||||
Permission232=Créer/modifier les facture fournisseurs
|
Permission232=Créer/modifier les facture fournisseurs
|
||||||
Permission233=Supprimer les factures fournisseurs
|
Permission233=Supprimer les factures fournisseurs
|
||||||
|
Permission251=Consulter les autres utilisateurs, leurs groupes et permissions
|
||||||
|
Permission252=Créer/modifier les autres utilisateurs, leurs groupes et permissions
|
||||||
|
Permission253=Modifier mot de passe des autres utilisateurs
|
||||||
|
Permission254=Supprimer ou désactiver les autres utilisateurs
|
||||||
|
Permission255=Créer/modifier ses propres infos utilisateur
|
||||||
|
Permission256=Modifier son propre mot de passe
|
||||||
Permission300=Consulter les codes barres
|
Permission300=Consulter les codes barres
|
||||||
Permission301=Créer/modifier les codes barres
|
Permission301=Créer/modifier les codes barres
|
||||||
Permission302=Supprimer les codes barres
|
Permission302=Supprimer les codes barres
|
||||||
|
|||||||
@ -69,3 +69,4 @@ LoginAccountDisable=Le compte est d
|
|||||||
UsePersonalValue=Utiliser valeur personalisée
|
UsePersonalValue=Utiliser valeur personalisée
|
||||||
ErrorFailedToSaveFile=Erreur - l'enregistrement du fichier a échoué
|
ErrorFailedToSaveFile=Erreur - l'enregistrement du fichier a échoué
|
||||||
GuiLanguage=Langage de l'interface
|
GuiLanguage=Langage de l'interface
|
||||||
|
InternalUser=Utilisateur interne
|
||||||
@ -34,11 +34,16 @@ require("./pre.inc.php");
|
|||||||
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
||||||
|
|
||||||
|
|
||||||
|
// Defini si peux lire/modifier utilisateurs et permisssions
|
||||||
|
$canreadperms=($user->admin || $user->rights->user->user->lire);
|
||||||
|
$caneditperms=($user->admin || $user->rights->user->user->creer);
|
||||||
|
$candisableperms=($user->admin || $user->rights->user->user->supprimer);
|
||||||
|
|
||||||
if ($user->id <> $_GET["id"])
|
if ($user->id <> $_GET["id"])
|
||||||
{
|
{
|
||||||
if (! $user->rights->user->user->lire && ! $user->admin)
|
if (! $canreadperms)
|
||||||
{
|
{
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,13 +59,13 @@ $action=isset($_GET["action"])?$_GET["action"]:$_POST["action"];
|
|||||||
/**
|
/**
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
if ($_GET["subaction"] == 'addrights' && $user->admin)
|
if ($_GET["subaction"] == 'addrights' && $caneditperms)
|
||||||
{
|
{
|
||||||
$edituser = new User($db,$_GET["id"]);
|
$edituser = new User($db,$_GET["id"]);
|
||||||
$edituser->addrights($_GET["rights"]);
|
$edituser->addrights($_GET["rights"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_GET["subaction"] == 'delrights' && $user->admin)
|
if ($_GET["subaction"] == 'delrights' && $caneditperms)
|
||||||
{
|
{
|
||||||
$edituser = new User($db,$_GET["id"]);
|
$edituser = new User($db,$_GET["id"]);
|
||||||
$edituser->delrights($_GET["rights"]);
|
$edituser->delrights($_GET["rights"]);
|
||||||
@ -74,6 +79,7 @@ if ($_POST["action"] == 'confirm_disable' && $_POST["confirm"] == "yes")
|
|||||||
$edituser->fetch($_GET["id"]);
|
$edituser->fetch($_GET["id"]);
|
||||||
$edituser->disable();
|
$edituser->disable();
|
||||||
Header("Location: ".DOL_URL_ROOT.'/user/fiche.php?id='.$_GET["id"]);
|
Header("Location: ".DOL_URL_ROOT.'/user/fiche.php?id='.$_GET["id"]);
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,11 +91,12 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes")
|
|||||||
$edituser->fetch($_GET["id"]);
|
$edituser->fetch($_GET["id"]);
|
||||||
$edituser->delete();
|
$edituser->delete();
|
||||||
Header("Location: index.php");
|
Header("Location: index.php");
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Action ajout user
|
// Action ajout user
|
||||||
if ($_POST["action"] == 'add' && $user->admin)
|
if ($_POST["action"] == 'add' && $caneditperms)
|
||||||
{
|
{
|
||||||
$message="";
|
$message="";
|
||||||
if (! $_POST["nom"]) {
|
if (! $_POST["nom"]) {
|
||||||
@ -130,6 +137,7 @@ if ($_POST["action"] == 'add' && $user->admin)
|
|||||||
$db->commit();
|
$db->commit();
|
||||||
|
|
||||||
Header("Location: fiche.php?id=$id");
|
Header("Location: fiche.php?id=$id");
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -143,7 +151,7 @@ if ($_POST["action"] == 'add' && $user->admin)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Action ajout groupe utilisateur
|
// Action ajout groupe utilisateur
|
||||||
if ($_POST["action"] == 'addgroup' && $user->admin)
|
if ($_POST["action"] == 'addgroup' && $caneditperms)
|
||||||
{
|
{
|
||||||
if ($_POST["group"])
|
if ($_POST["group"])
|
||||||
{
|
{
|
||||||
@ -151,10 +159,11 @@ if ($_POST["action"] == 'addgroup' && $user->admin)
|
|||||||
$edituser->SetInGroup($_POST["group"]);
|
$edituser->SetInGroup($_POST["group"]);
|
||||||
|
|
||||||
Header("Location: fiche.php?id=".$_GET["id"]);
|
Header("Location: fiche.php?id=".$_GET["id"]);
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_GET["action"] == 'removegroup' && $user->admin)
|
if ($_GET["action"] == 'removegroup' && $caneditperms)
|
||||||
{
|
{
|
||||||
if ($_GET["group"])
|
if ($_GET["group"])
|
||||||
{
|
{
|
||||||
@ -162,10 +171,11 @@ if ($_GET["action"] == 'removegroup' && $user->admin)
|
|||||||
$edituser->RemoveFromGroup($_GET["group"]);
|
$edituser->RemoveFromGroup($_GET["group"]);
|
||||||
|
|
||||||
Header("Location: fiche.php?id=".$_GET["id"]);
|
Header("Location: fiche.php?id=".$_GET["id"]);
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST["action"] == 'update' && $user->admin)
|
if ($_POST["action"] == 'update' && $caneditperms)
|
||||||
{
|
{
|
||||||
$message="";
|
$message="";
|
||||||
|
|
||||||
@ -201,18 +211,21 @@ if ($_POST["action"] == 'update' && $user->admin)
|
|||||||
if ($ret >= 0 && isset($_POST["password"]) && $_POST["password"] !='' )
|
if ($ret >= 0 && isset($_POST["password"]) && $_POST["password"] !='' )
|
||||||
{
|
{
|
||||||
$ret=$edituser->password($user,$password,$conf->password_encrypted);
|
$ret=$edituser->password($user,$password,$conf->password_encrypted);
|
||||||
if ($ret < 0) {
|
if ($ret < 0)
|
||||||
|
{
|
||||||
$message.='<div class="error">'.$edituser->error.'</div>';
|
$message.='<div class="error">'.$edituser->error.'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_FILES['photo']['tmp_name']) {
|
if (isset($_FILES['photo']['tmp_name']) && trim($_FILES['photo']['tmp_name']))
|
||||||
|
{
|
||||||
// Si une photo est fournie avec le formulaire
|
// Si une photo est fournie avec le formulaire
|
||||||
if (! is_dir($conf->users->dir_output))
|
if (! is_dir($conf->users->dir_output))
|
||||||
{
|
{
|
||||||
create_exdir($conf->users->dir_output);
|
create_exdir($conf->users->dir_output);
|
||||||
}
|
}
|
||||||
if (is_dir($conf->users->dir_output)) {
|
if (is_dir($conf->users->dir_output))
|
||||||
|
{
|
||||||
$newfile=$conf->users->dir_output . "/" . $edituser->id . ".jpg";
|
$newfile=$conf->users->dir_output . "/" . $edituser->id . ".jpg";
|
||||||
if (! doliMoveFileUpload($_FILES['photo']['tmp_name'],$newfile))
|
if (! doliMoveFileUpload($_FILES['photo']['tmp_name'],$newfile))
|
||||||
{
|
{
|
||||||
@ -221,10 +234,12 @@ if ($_POST["action"] == 'update' && $user->admin)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ret >= 0) {
|
if ($ret >= 0)
|
||||||
|
{
|
||||||
$message.='<div class="ok">'.$langs->trans("UserModified").'</div>';
|
$message.='<div class="ok">'.$langs->trans("UserModified").'</div>';
|
||||||
$db->commit();
|
$db->commit();
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
$db->rollback;
|
$db->rollback;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,7 +247,7 @@ if ($_POST["action"] == 'update' && $user->admin)
|
|||||||
|
|
||||||
// Action modif mot de passe
|
// Action modif mot de passe
|
||||||
if ((($_POST["action"] == 'confirm_password' && $_POST["confirm"] == 'yes')
|
if ((($_POST["action"] == 'confirm_password' && $_POST["confirm"] == 'yes')
|
||||||
|| $_GET["action"] == 'confirm_passwordsend') && $user->admin)
|
|| $_GET["action"] == 'confirm_passwordsend') && $caneditperms)
|
||||||
{
|
{
|
||||||
$edituser = new User($db, $_GET["id"]);
|
$edituser = new User($db, $_GET["id"]);
|
||||||
$edituser->fetch();
|
$edituser->fetch();
|
||||||
@ -346,6 +361,9 @@ else
|
|||||||
$fuser->fetch();
|
$fuser->fetch();
|
||||||
$fuser->getrights();
|
$fuser->getrights();
|
||||||
|
|
||||||
|
$caneditpassword=( (($user->id == $fuser->id) && $user->rights->user->self->password)
|
||||||
|
|| (($user->id != $fuser->id) && $user->rights->user->user->password) );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage onglets
|
* Affichage onglets
|
||||||
*/
|
*/
|
||||||
@ -432,7 +450,7 @@ else
|
|||||||
|
|
||||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Lastname").'</td>';
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Lastname").'</td>';
|
||||||
print '<td width="50%" class="valeur">'.$fuser->nom.'</td>';
|
print '<td width="50%" class="valeur">'.$fuser->nom.'</td>';
|
||||||
print '<td align="center" valign="middle" width="25%" rowspan="13">';
|
print '<td align="center" valign="middle" width="25%" rowspan="14">';
|
||||||
if (file_exists($conf->users->dir_output."/".$fuser->id.".jpg"))
|
if (file_exists($conf->users->dir_output."/".$fuser->id.".jpg"))
|
||||||
{
|
{
|
||||||
print '<img width="100" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=userphoto&file='.$fuser->id.'.jpg">';
|
print '<img width="100" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=userphoto&file='.$fuser->id.'.jpg">';
|
||||||
@ -525,7 +543,7 @@ else
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print "<tr>".'<td width="25%" valign="top">'.$langs->trans("Note").'</td>';
|
print "<tr>".'<td width="25%" valign="top">'.$langs->trans("Note").'</td>';
|
||||||
print '<td colspan="2" class="valeur">'.nl2br($fuser->note).' </td>';
|
print '<td class="valeur">'.nl2br($fuser->note).' </td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
// Autres caractéristiques issus des autres modules
|
// Autres caractéristiques issus des autres modules
|
||||||
@ -548,27 +566,27 @@ else
|
|||||||
*/
|
*/
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
if ($user->admin || ($user->id == $fuser->id))
|
if ($caneditperms || ($user->id == $fuser->id))
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&action=edit">'.$langs->trans("Edit").'</a>';
|
print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&action=edit">'.$langs->trans("Edit").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($user->id != $_GET["id"] && $user->admin) && $fuser->login)
|
if (($user->id != $_GET["id"] && $caneditpassword) && $fuser->login)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&action=password">'.$langs->trans("ReinitPassword").'</a>';
|
print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&action=password">'.$langs->trans("ReinitPassword").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($user->id != $_GET["id"] && $user->admin) && $fuser->email && $fuser->login)
|
if (($user->id != $_GET["id"] && $caneditpassword) && $fuser->email && $fuser->login)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&action=passwordsend">'.$langs->trans("SendNewPassword").'</a>';
|
print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&action=passwordsend">'.$langs->trans("SendNewPassword").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->id <> $_GET["id"] && $user->admin && $fuser->login)
|
if ($user->id <> $_GET["id"] && $candisableperms && $fuser->login)
|
||||||
{
|
{
|
||||||
print '<a class="butActionDelete" href="fiche.php?action=disable&id='.$fuser->id.'">'.$langs->trans("DisableUser").'</a>';
|
print '<a class="butActionDelete" href="fiche.php?action=disable&id='.$fuser->id.'">'.$langs->trans("DisableUser").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->id <> $_GET["id"] && $user->admin)
|
if ($user->id <> $_GET["id"] && $candisableperms)
|
||||||
{
|
{
|
||||||
print '<a class="butActionDelete" href="fiche.php?action=delete&id='.$fuser->id.'">'.$langs->trans("DeleteUser").'</a>';
|
print '<a class="butActionDelete" href="fiche.php?action=delete&id='.$fuser->id.'">'.$langs->trans("DeleteUser").'</a>';
|
||||||
}
|
}
|
||||||
@ -611,7 +629,7 @@ else
|
|||||||
dolibarr_print_error($db);
|
dolibarr_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->admin)
|
if ($caneditperms)
|
||||||
{
|
{
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
print '<form action="fiche.php?id='.$_GET["id"].'" method="post">'."\n";
|
print '<form action="fiche.php?id='.$_GET["id"].'" method="post">'."\n";
|
||||||
@ -663,7 +681,7 @@ else
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
|
|
||||||
if ($user->admin)
|
if ($caneditperms)
|
||||||
{
|
{
|
||||||
|
|
||||||
print '<a href="fiche.php?id='.$_GET["id"].'&action=removegroup&group='.$obj->rowid.'">';
|
print '<a href="fiche.php?id='.$_GET["id"].'&action=removegroup&group='.$obj->rowid.'">';
|
||||||
@ -694,15 +712,14 @@ else
|
|||||||
/*
|
/*
|
||||||
* Fiche en mode edition
|
* Fiche en mode edition
|
||||||
*/
|
*/
|
||||||
if ($_GET["action"] == 'edit' && ($user->admin || ($user->id == $fuser->id)))
|
if ($_GET["action"] == 'edit' && ($caneditperms || ($user->id == $fuser->id)))
|
||||||
{
|
{
|
||||||
|
|
||||||
print '<form action="fiche.php?id='.$fuser->id.'" method="post" name="updateuser" enctype="multipart/form-data">';
|
print '<form action="fiche.php?id='.$fuser->id.'" method="post" name="updateuser" enctype="multipart/form-data">';
|
||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
print '<table width="100%" class="border">';
|
print '<table width="100%" class="border">';
|
||||||
|
|
||||||
$rowspan=11;
|
$rowspan=12;
|
||||||
if ($conf->global->USER_ALLOW_PASSWORD_CHANGE) $rowspan++;
|
|
||||||
|
|
||||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Lastname").'</td>';
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Lastname").'</td>';
|
||||||
print '<td width="50%" class="valeur"><input class="flat" size="30" type="text" name="nom" value="'.$fuser->nom.'"></td>';
|
print '<td width="50%" class="valeur"><input class="flat" size="30" type="text" name="nom" value="'.$fuser->nom.'"></td>';
|
||||||
@ -729,11 +746,17 @@ else
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Pass
|
// Pass
|
||||||
if ($conf->global->USER_ALLOW_PASSWORD_CHANGE)
|
if ($caneditpassword)
|
||||||
{
|
{
|
||||||
print "<tr>".'<td valign="top">'.$langs->trans("Password").'</td>';
|
print "<tr>".'<td valign="top">'.$langs->trans("Password").'</td>';
|
||||||
print '<td><input size="12" maxlength="8" type="password" class="flat" name="pass" value="'.$fuser->pass.'"></td></tr>';
|
print '<td><input size="12" maxlength="8" type="password" class="flat" name="pass" value="'.$fuser->pass.'"></td></tr>';
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Password").'</td>';
|
||||||
|
print '<td width="50%" class="valeur">'.eregi_replace('.','*',$fuser->pass).'</td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
}
|
||||||
|
|
||||||
// Administrateur
|
// Administrateur
|
||||||
print "<tr>".'<td valign="top">'.$langs->trans("Administrator").'</td>';
|
print "<tr>".'<td valign="top">'.$langs->trans("Administrator").'</td>';
|
||||||
@ -799,7 +822,7 @@ else
|
|||||||
print '<td><input size="40" type="text" name="email" class="flat" value="'.$fuser->email.'"></td></tr>';
|
print '<td><input size="40" type="text" name="email" class="flat" value="'.$fuser->email.'"></td></tr>';
|
||||||
|
|
||||||
print "<tr>".'<td valign="top">'.$langs->trans("Note").'</td><td>';
|
print "<tr>".'<td valign="top">'.$langs->trans("Note").'</td><td>';
|
||||||
print '<textarea class="flat" name="note" rows="4" cols="40">';
|
print '<textarea class="flat" name="note" rows="'.ROWS_3.'" cols="70">';
|
||||||
print $fuser->note;
|
print $fuser->note;
|
||||||
print "</textarea></td></tr>";
|
print "</textarea></td></tr>";
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,9 @@
|
|||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
|
|
||||||
if (! $user->rights->user->group->lire && !$user->admin) accessforbidden();
|
$user->getrights();
|
||||||
|
|
||||||
|
if (! $user->rights->user->user->lire && ! $user->admin) accessforbidden();
|
||||||
|
|
||||||
$langs->load("users");
|
$langs->load("users");
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,9 @@
|
|||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
|
|
||||||
if (! $user->rights->user->user->lire && !$user->admin) accessforbidden();
|
$user->getrights();
|
||||||
|
|
||||||
|
if (! $user->rights->user->user->lire && ! $user->admin) accessforbidden();
|
||||||
|
|
||||||
$langs->load("users");
|
$langs->load("users");
|
||||||
|
|
||||||
@ -37,7 +39,6 @@ $sall=isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"];
|
|||||||
$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
|
$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
|
||||||
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
|
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
|
||||||
$page=isset($_GET["page"])?$_GET["page"]:$_POST["page"];
|
$page=isset($_GET["page"])?$_GET["page"]:$_POST["page"];
|
||||||
$page = $_GET["page"];
|
|
||||||
if ($page < 0) $page = 0;
|
if ($page < 0) $page = 0;
|
||||||
|
|
||||||
$limit = $conf->liste_limit;
|
$limit = $conf->liste_limit;
|
||||||
|
|||||||
@ -38,17 +38,21 @@ $form = new Form($db);
|
|||||||
|
|
||||||
$module=isset($_GET["module"])?$_GET["module"]:$_POST["module"];
|
$module=isset($_GET["module"])?$_GET["module"]:$_POST["module"];
|
||||||
|
|
||||||
|
// Defini si peux modifier utilisateurs et permisssions
|
||||||
|
$caneditperms=($user->admin || $user->rights->user->user->creer);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
if ($_GET["action"] == 'addrights' && $user->admin)
|
if ($_GET["action"] == 'addrights' && $caneditperms)
|
||||||
{
|
{
|
||||||
$edituser = new User($db,$_GET["id"]);
|
$edituser = new User($db,$_GET["id"]);
|
||||||
$edituser->addrights($_GET["rights"],$module);
|
$edituser->addrights($_GET["rights"],$module);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_GET["action"] == 'delrights' && $user->admin)
|
if ($_GET["action"] == 'delrights' && $caneditperms)
|
||||||
{
|
{
|
||||||
$edituser = new User($db,$_GET["id"]);
|
$edituser = new User($db,$_GET["id"]);
|
||||||
$edituser->delrights($_GET["rights"],$module);
|
$edituser->delrights($_GET["rights"],$module);
|
||||||
@ -196,7 +200,7 @@ if ($_GET["id"])
|
|||||||
print '<table width="100%" class="noborder">';
|
print '<table width="100%" class="noborder">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Module").'</td>';
|
print '<td>'.$langs->trans("Module").'</td>';
|
||||||
if ($user->admin) print '<td width="24"> </td>';
|
if ($caneditperms) print '<td width="24"> </td>';
|
||||||
print '<td align="center" width="24"> </td>';
|
print '<td align="center" width="24"> </td>';
|
||||||
print '<td>'.$langs->trans("Permissions").'</td>';
|
print '<td>'.$langs->trans("Permissions").'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -232,16 +236,20 @@ if ($_GET["id"])
|
|||||||
$objMod=$modules[$obj->module];
|
$objMod=$modules[$obj->module];
|
||||||
$picto=($objMod->picto?$objMod->picto:'generic');
|
$picto=($objMod->picto?$objMod->picto:'generic');
|
||||||
|
|
||||||
print '<tr '. $bc[$var].'>';
|
if ($caneditperms && ($obj->module != 'user' || ! $user->admin))
|
||||||
print '<td>'.img_object('',$picto).' '.$objMod->getName();
|
{
|
||||||
print '<a name="'.$objMod->getName().'"> </a></td>';
|
// On affiche ligne pour modifier droits
|
||||||
print '<td align="center" nowrap>';
|
print '<tr '. $bc[$var].'>';
|
||||||
print '<a title='.$langs->trans("All").' alt='.$langs->trans("All").' href="perms.php?id='.$fuser->id.'&action=addrights&module='.$obj->module.'">'.$langs->trans("All")."</a>";
|
print '<td>'.img_object('',$picto).' '.$objMod->getName();
|
||||||
print '/';
|
print '<a name="'.$objMod->getName().'"> </a></td>';
|
||||||
print '<a title='.$langs->trans("None").' alt='.$langs->trans("None").' href="perms.php?id='.$fuser->id.'&action=delrights&module='.$obj->module.'">'.$langs->trans("None")."</a>";
|
print '<td align="center" nowrap>';
|
||||||
print '</td>';
|
print '<a title='.$langs->trans("All").' alt='.$langs->trans("All").' href="perms.php?id='.$fuser->id.'&action=addrights&module='.$obj->module.'">'.$langs->trans("All")."</a>";
|
||||||
print '<td colspan="2"> </td>';
|
print '/';
|
||||||
print '</tr>';
|
print '<a title='.$langs->trans("None").' alt='.$langs->trans("None").' href="perms.php?id='.$fuser->id.'&action=delrights&module='.$obj->module.'">'.$langs->trans("None")."</a>";
|
||||||
|
print '</td>';
|
||||||
|
print '<td colspan="2"> </td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr '. $bc[$var].'>';
|
print '<tr '. $bc[$var].'>';
|
||||||
@ -249,10 +257,21 @@ if ($_GET["id"])
|
|||||||
print '<td>'.img_object('',$picto).' '.$objMod->getName();
|
print '<td>'.img_object('',$picto).' '.$objMod->getName();
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
if (in_array($obj->id, $permsuser))
|
if ($fuser->admin && $obj->module == 'user')
|
||||||
{
|
{
|
||||||
// Own permission by user
|
// Permission own because admin
|
||||||
if ($user->admin)
|
if ($caneditperms)
|
||||||
|
{
|
||||||
|
print '<td align="center">'.img_picto($langs->trans("Administrator"),'star').'</td>';
|
||||||
|
}
|
||||||
|
print '<td align="center" nowrap>';
|
||||||
|
print img_tick();
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
else if (in_array($obj->id, $permsuser))
|
||||||
|
{
|
||||||
|
// Permission own by user
|
||||||
|
if ($caneditperms)
|
||||||
{
|
{
|
||||||
print '<td align="center"><a href="perms.php?id='.$fuser->id.'&action=delrights&rights='.$obj->id.'">'.img_edit_remove($langs->trans("Remove")).'</a></td>';
|
print '<td align="center"><a href="perms.php?id='.$fuser->id.'&action=delrights&rights='.$obj->id.'">'.img_edit_remove($langs->trans("Remove")).'</a></td>';
|
||||||
}
|
}
|
||||||
@ -261,19 +280,19 @@ if ($_GET["id"])
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
else if (in_array($obj->id, $permsgroup)) {
|
else if (in_array($obj->id, $permsgroup)) {
|
||||||
// Own permission by group
|
// Permission own by group
|
||||||
if ($user->admin)
|
if ($caneditperms)
|
||||||
{
|
{
|
||||||
print '<td align="center">'.$langs->trans("Group").'</td>';
|
print '<td align="center">'.$langs->trans("Group").'</td>';
|
||||||
}
|
}
|
||||||
print '<td align="left" nowrap>';
|
print '<td align="center" nowrap>';
|
||||||
print img_tick();
|
print img_tick();
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Do not own permission
|
// Do not own permission
|
||||||
if ($user->admin)
|
if ($caneditperms)
|
||||||
{
|
{
|
||||||
print '<td align="center"><a href="perms.php?id='.$fuser->id.'&action=addrights&rights='.$obj->id.'">'.img_edit_add($langs->trans("Add")).'</a></td>';
|
print '<td align="center"><a href="perms.php?id='.$fuser->id.'&action=addrights&rights='.$obj->id.'">'.img_edit_add($langs->trans("Add")).'</a></td>';
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user