forked from Wavyzz/dolibarr
Qual: Clean LDAP code
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -231,7 +231,7 @@ else
|
|||||||
{
|
{
|
||||||
print '<input size="25" type="text" name="pass" value="'.$conf->global->LDAP_ADMIN_PASS.'">';
|
print '<input size="25" type="text" name="pass" value="'.$conf->global->LDAP_ADMIN_PASS.'">';
|
||||||
}
|
}
|
||||||
print '</td><td> </td></tr>';
|
print '</td><td>secret</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -47,7 +47,6 @@ if (!$user->admin)
|
|||||||
if ($_GET["action"] == 'setvalue' && $user->admin)
|
if ($_GET["action"] == 'setvalue' && $user->admin)
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_KEY_CONTACTS',$_POST["key"],'chaine',0,'',$conf->entity)) $error++;
|
|
||||||
|
|
||||||
if (! dolibarr_set_const($db, 'LDAP_CONTACT_DN',$_POST["contactdn"],'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_CONTACT_DN',$_POST["contactdn"],'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_CONTACT_OBJECT_CLASS',$_POST["objectclass"],'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_CONTACT_OBJECT_CLASS',$_POST["objectclass"],'chaine',0,'',$conf->entity)) $error++;
|
||||||
@@ -66,6 +65,12 @@ if ($_GET["action"] == 'setvalue' && $user->admin)
|
|||||||
if (! dolibarr_set_const($db, 'LDAP_CONTACT_FIELD_TOWN',$_POST["fieldtown"],'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_CONTACT_FIELD_TOWN',$_POST["fieldtown"],'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_CONTACT_FIELD_COUNTRY',$_POST["fieldcountry"],'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_CONTACT_FIELD_COUNTRY',$_POST["fieldcountry"],'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
|
||||||
|
// This one must be after the others
|
||||||
|
$valkey='';
|
||||||
|
$key=$_POST["key"];
|
||||||
|
if ($key) $valkey=$conf->global->$key;
|
||||||
|
if (! dolibarr_set_const($db, 'LDAP_KEY_CONTACTS',$valkey,'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
dol_print_error($db->error());
|
dol_print_error($db->error());
|
||||||
@@ -144,7 +149,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldFullname").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldFullname").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldfullname" value="'.$conf->global->LDAP_CONTACT_FIELD_FULLNAME.'">';
|
print '<input size="25" type="text" name="fieldfullname" value="'.$conf->global->LDAP_CONTACT_FIELD_FULLNAME.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldFullnameExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldFullnameExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_CONTACT_FIELD_FULLNAME.'"'.($conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_FULLNAME?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_CONTACT_FIELD_FULLNAME"'.($conf->global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_FULLNAME?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Name
|
// Name
|
||||||
@@ -152,7 +157,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldName").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldName").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldname" value="'.$conf->global->LDAP_CONTACT_FIELD_NAME.'">';
|
print '<input size="25" type="text" name="fieldname" value="'.$conf->global->LDAP_CONTACT_FIELD_NAME.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldNameExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldNameExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_CONTACT_FIELD_NAME.'"'.($conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_NAME?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_CONTACT_FIELD_NAME"'.($conf->global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_NAME?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Firstname
|
// Firstname
|
||||||
@@ -160,7 +165,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldFirstName").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldFirstName").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldfirstname" value="'.$conf->global->LDAP_CONTACT_FIELD_FIRSTNAME.'">';
|
print '<input size="25" type="text" name="fieldfirstname" value="'.$conf->global->LDAP_CONTACT_FIELD_FIRSTNAME.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldFirstNameExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldFirstNameExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_CONTACT_FIELD_FIRSTNAME.'"'.($conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_FIRSTNAME?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_CONTACT_FIELD_FIRSTNAME"'.($conf->global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_FIRSTNAME?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Company
|
// Company
|
||||||
@@ -168,7 +173,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldCompany").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldCompany").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldcompany" value="'.$conf->global->LDAP_CONTACT_FIELD_COMPANY.'">';
|
print '<input size="25" type="text" name="fieldcompany" value="'.$conf->global->LDAP_CONTACT_FIELD_COMPANY.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldCompanyExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldCompanyExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_CONTACT_FIELD_COMPANY.'"'.($conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_COMPANY?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_CONTACT_FIELD_COMPANY"'.($conf->global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_COMPANY?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Mail
|
// Mail
|
||||||
@@ -176,7 +181,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldMail").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldMail").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldmail" value="'.$conf->global->LDAP_CONTACT_FIELD_MAIL.'">';
|
print '<input size="25" type="text" name="fieldmail" value="'.$conf->global->LDAP_CONTACT_FIELD_MAIL.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldMailExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldMailExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_CONTACT_FIELD_MAIL.'"'.($conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_MAIL?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value=">LDAP_CONTACT_FIELD_MAIL"'.($conf->global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_MAIL?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Phone pro
|
// Phone pro
|
||||||
@@ -184,7 +189,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldPhone").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldPhone").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldphone" value="'.$conf->global->LDAP_CONTACT_FIELD_PHONE.'">';
|
print '<input size="25" type="text" name="fieldphone" value="'.$conf->global->LDAP_CONTACT_FIELD_PHONE.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldPhoneExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldPhoneExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_CONTACT_FIELD_PHONE.'"'.($conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_PHONE?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_CONTACT_FIELD_PHONE"'.($conf->global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_PHONE?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Phone home
|
// Phone home
|
||||||
@@ -192,7 +197,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldHomePhone").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldHomePhone").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldhomephone" value="'.$conf->global->LDAP_CONTACT_FIELD_HOMEPHONE.'">';
|
print '<input size="25" type="text" name="fieldhomephone" value="'.$conf->global->LDAP_CONTACT_FIELD_HOMEPHONE.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldHomePhoneExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldHomePhoneExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_CONTACT_FIELD_HOMEPHONE.'"'.($conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_HOMEPHONE?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_CONTACT_FIELD_HOMEPHONE"'.($conf->global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_HOMEPHONE?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Mobile
|
// Mobile
|
||||||
@@ -200,7 +205,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldMobile").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldMobile").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldmobile" value="'.$conf->global->LDAP_CONTACT_FIELD_MOBILE.'">';
|
print '<input size="25" type="text" name="fieldmobile" value="'.$conf->global->LDAP_CONTACT_FIELD_MOBILE.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldMobileExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldMobileExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_CONTACT_FIELD_MOBILE.'"'.($conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_MOBILE?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_CONTACT_FIELD_MOBILE"'.($conf->global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_MOBILE?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Fax
|
// Fax
|
||||||
@@ -208,7 +213,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldFax").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldFax").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldfax" value="'.$conf->global->LDAP_CONTACT_FIELD_FAX.'">';
|
print '<input size="25" type="text" name="fieldfax" value="'.$conf->global->LDAP_CONTACT_FIELD_FAX.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldFaxExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldFaxExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_CONTACT_FIELD_FAX.'"'.($conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_FAX?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_CONTACT_FIELD_FAX"'.($conf->global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_FAX?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Address
|
// Address
|
||||||
@@ -216,7 +221,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldAddress").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldAddress").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldaddress" value="'.$conf->global->LDAP_CONTACT_FIELD_ADDRESS.'">';
|
print '<input size="25" type="text" name="fieldaddress" value="'.$conf->global->LDAP_CONTACT_FIELD_ADDRESS.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldAddressExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldAddressExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_CONTACT_FIELD_ADDRESS.'"'.($conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_ADDRESS?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_CONTACT_FIELD_ADDRESS"'.($conf->global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_ADDRESS?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// CP
|
// CP
|
||||||
@@ -224,7 +229,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldZip").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldZip").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldzip" value="'.$conf->global->LDAP_CONTACT_FIELD_ZIP.'">';
|
print '<input size="25" type="text" name="fieldzip" value="'.$conf->global->LDAP_CONTACT_FIELD_ZIP.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldZipExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldZipExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_CONTACT_FIELD_ZIP.'"'.($conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_ZIP?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_CONTACT_FIELD_ZIP"'.($conf->global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_ZIP?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Ville
|
// Ville
|
||||||
@@ -232,7 +237,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldTown").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldTown").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldtown" value="'.$conf->global->LDAP_CONTACT_FIELD_TOWN.'">';
|
print '<input size="25" type="text" name="fieldtown" value="'.$conf->global->LDAP_CONTACT_FIELD_TOWN.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldTownExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldTownExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_CONTACT_FIELD_TOWN.'"'.($conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_TOWN?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_CONTACT_FIELD_TOWN"'.($conf->global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_TOWN?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Pays
|
// Pays
|
||||||
@@ -240,7 +245,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldCountry").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldCountry").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldcountry" value="'.$conf->global->LDAP_CONTACT_FIELD_COUNTRY.'">';
|
print '<input size="25" type="text" name="fieldcountry" value="'.$conf->global->LDAP_CONTACT_FIELD_COUNTRY.'">';
|
||||||
print '</td><td> </td>';
|
print '</td><td> </td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_CONTACT_FIELD_COUNTRY.'"'.($conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_COUNTRY?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_CONTACT_FIELD_COUNTRY"'.($conf->global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_COUNTRY?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -48,7 +48,6 @@ if (!$user->admin)
|
|||||||
if ($_GET["action"] == 'setvalue' && $user->admin)
|
if ($_GET["action"] == 'setvalue' && $user->admin)
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_KEY_GROUPS',$_POST["key"],'chaine',0,'',$conf->entity)) $error++;
|
|
||||||
|
|
||||||
if (! dolibarr_set_const($db, 'LDAP_GROUP_DN',$_POST["group"],'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_GROUP_DN',$_POST["group"],'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_GROUP_OBJECT_CLASS',$_POST["objectclass"],'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_GROUP_OBJECT_CLASS',$_POST["objectclass"],'chaine',0,'',$conf->entity)) $error++;
|
||||||
@@ -58,6 +57,12 @@ if ($_GET["action"] == 'setvalue' && $user->admin)
|
|||||||
if (! dolibarr_set_const($db, 'LDAP_GROUP_FIELD_DESCRIPTION',$_POST["fielddescription"],'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_GROUP_FIELD_DESCRIPTION',$_POST["fielddescription"],'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_GROUP_FIELD_GROUPMEMBERS',$_POST["fieldgroupmembers"],'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_GROUP_FIELD_GROUPMEMBERS',$_POST["fieldgroupmembers"],'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
|
||||||
|
// This one must be after the others
|
||||||
|
$valkey='';
|
||||||
|
$key=$_POST["key"];
|
||||||
|
if ($key) $valkey=$conf->global->$key;
|
||||||
|
if (! dolibarr_set_const($db, 'LDAP_KEY_GROUPS',$valkey,'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
dol_print_error($db->error());
|
dol_print_error($db->error());
|
||||||
@@ -132,20 +137,13 @@ print '<td align="right">'.$langs->trans("LDAPNamingAttribute").'</td>';
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
// Filtre
|
// Filtre
|
||||||
/*
|
|
||||||
$var=!$var;
|
|
||||||
print '<tr '.$bc[$var].'><td><span class="fieldrequired">'.$langs->trans("LDAPFilterConnection").'</span></td><td>';
|
|
||||||
print '<input size="38" type="text" name="filterconnection" value="'.$conf->global->LDAP_FILTER_CONNECTION.'">';
|
|
||||||
print '</td><td>'.$langs->trans("LDAPFilterConnectionExample").'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Common name
|
// Common name
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldName").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldName").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldfullname" value="'.$conf->global->LDAP_GROUP_FIELD_FULLNAME.'">';
|
print '<input size="25" type="text" name="fieldfullname" value="'.$conf->global->LDAP_GROUP_FIELD_FULLNAME.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldCommonNameExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldCommonNameExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_GROUP_FIELD_FULLNAME.'"'.($conf->global->LDAP_KEY_GROUPS==$conf->global->LDAP_GROUP_FIELD_FULLNAME?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_GROUP_FIELD_FULLNAME"'.(($conf->global->LDAP_KEY_GROUPS && $conf->global->LDAP_KEY_GROUPS==$conf->global->LDAP_GROUP_FIELD_FULLNAME)?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Name
|
// Name
|
||||||
@@ -162,7 +160,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldDescription").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldDescription").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fielddescription" value="'.$conf->global->LDAP_GROUP_FIELD_DESCRIPTION.'">';
|
print '<input size="25" type="text" name="fielddescription" value="'.$conf->global->LDAP_GROUP_FIELD_DESCRIPTION.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldDescriptionExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldDescriptionExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_GROUP_FIELD_DESCRIPTION.'"'.($conf->global->LDAP_KEY_GROUPS==$conf->global->LDAP_GROUP_FIELD_DESCRIPTION?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_GROUP_FIELD_DESCRIPTION"'.(($conf->global->LDAP_KEY_GROUPS && $conf->global->LDAP_KEY_GROUPS==$conf->global->LDAP_GROUP_FIELD_DESCRIPTION)?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// User group
|
// User group
|
||||||
@@ -170,7 +168,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldGroupMembers").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldGroupMembers").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldgroupmembers" value="'.$conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS.'">';
|
print '<input size="25" type="text" name="fieldgroupmembers" value="'.$conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldGroupMembersExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldGroupMembersExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS.'"'.($conf->global->LDAP_KEY_GROUPS==$conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_GROUP_FIELD_GROUPMEMBERS"'.(($conf->global->LDAP_KEY_GROUPS && $conf->global->LDAP_KEY_GROUPS==$conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS)?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ if (!$user->admin)
|
|||||||
if ($_GET["action"] == 'setvalue' && $user->admin)
|
if ($_GET["action"] == 'setvalue' && $user->admin)
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_KEY_MEMBERS',$_POST["key"],'chaine',0,'',$conf->entity)) $error++;
|
|
||||||
|
|
||||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_DN',$_POST["user"],'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_DN',$_POST["user"],'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_OBJECT_CLASS',$_POST["objectclass"],'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_MEMBER_OBJECT_CLASS',$_POST["objectclass"],'chaine',0,'',$conf->entity)) $error++;
|
||||||
@@ -80,6 +79,12 @@ if ($_GET["action"] == 'setvalue' && $user->admin)
|
|||||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE', $_POST["fieldlastsubscriptiondate"],'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE', $_POST["fieldlastsubscriptiondate"],'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT', $_POST["fieldlastsubscriptionamount"],'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT', $_POST["fieldlastsubscriptionamount"],'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
|
||||||
|
// This one must be after the others
|
||||||
|
$valkey='';
|
||||||
|
$key=$_POST["key"];
|
||||||
|
if ($key) $valkey=$conf->global->$key;
|
||||||
|
if (! dolibarr_set_const($db, 'LDAP_KEY_MEMBERS',$valkey,'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
dol_print_error($db->error());
|
dol_print_error($db->error());
|
||||||
@@ -155,20 +160,13 @@ print '<td align="right">'.$langs->trans("LDAPNamingAttribute").'</td>';
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
// Filtre
|
// Filtre
|
||||||
/*
|
|
||||||
$var=!$var;
|
|
||||||
print '<tr '.$bc[$var].'><td><span class="fieldrequired">'.$langs->trans("LDAPFilterConnection").'</span></td><td>';
|
|
||||||
print '<input size="38" type="text" name="filterconnection" value="'.$conf->global->LDAP_FILTER_CONNECTION.'">';
|
|
||||||
print '</td><td>'.$langs->trans("LDAPFilterConnectionExample").'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Common name
|
// Common name
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldFullname").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldFullname").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldfullname" value="'.$conf->global->LDAP_MEMBER_FIELD_FULLNAME.'">';
|
print '<input size="25" type="text" name="fieldfullname" value="'.$conf->global->LDAP_MEMBER_FIELD_FULLNAME.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldFullnameExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldFullnameExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_MEMBER_FIELD_FULLNAME.'"'.($conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_FULLNAME?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_MEMBER_FIELD_FULLNAME"'.(($conf->global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_FULLNAME)?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Name
|
// Name
|
||||||
@@ -176,7 +174,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldName").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldName").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldname" value="'.$conf->global->LDAP_MEMBER_FIELD_NAME.'">';
|
print '<input size="25" type="text" name="fieldname" value="'.$conf->global->LDAP_MEMBER_FIELD_NAME.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldNameExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldNameExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_MEMBER_FIELD_NAME.'"'.($conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_NAME?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_MEMBER_FIELD_NAME"'.(($conf->global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_NAME)?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Firstname
|
// Firstname
|
||||||
@@ -192,7 +190,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldLoginUnix").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldLoginUnix").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldlogin" value="'.$conf->global->LDAP_MEMBER_FIELD_LOGIN.'">';
|
print '<input size="25" type="text" name="fieldlogin" value="'.$conf->global->LDAP_MEMBER_FIELD_LOGIN.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldLoginExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldLoginExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_MEMBER_FIELD_LOGIN.'"'.($conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_LOGIN?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_MEMBER_FIELD_LOGIN"'.(($conf->global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_LOGIN)?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Login samba
|
// Login samba
|
||||||
@@ -200,7 +198,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldLoginSamba").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldLoginSamba").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldloginsamba" value="'.$conf->global->LDAP_MEMBER_FIELD_LOGIN_SAMBA.'">';
|
print '<input size="25" type="text" name="fieldloginsamba" value="'.$conf->global->LDAP_MEMBER_FIELD_LOGIN_SAMBA.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldLoginSambaExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldLoginSambaExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_MEMBER_FIELD_LOGIN_SAMBA.'"'.($conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_LOGIN_SAMBA?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_MEMBER_FIELD_LOGIN_SAMBA"'.(($conf->global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_LOGIN_SAMBA)?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Password not crypted
|
// Password not crypted
|
||||||
@@ -224,7 +222,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldMail").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldMail").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldmail" value="'.$conf->global->LDAP_MEMBER_FIELD_MAIL.'">';
|
print '<input size="25" type="text" name="fieldmail" value="'.$conf->global->LDAP_MEMBER_FIELD_MAIL.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldMailExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldMailExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_MEMBER_FIELD_MAIL.'"'.($conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_MAIL?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_MEMBER_FIELD_MAIL"'.(($conf->global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_MAIL)?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Phone pro
|
// Phone pro
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -48,7 +48,6 @@ if (!$user->admin)
|
|||||||
if ($_GET["action"] == 'setvalue' && $user->admin)
|
if ($_GET["action"] == 'setvalue' && $user->admin)
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_KEY_USERS',$_POST["key"],'chaine',0,'',$conf->entity)) $error++;
|
|
||||||
|
|
||||||
if (! dolibarr_set_const($db, 'LDAP_USER_DN',$_POST["user"],'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_USER_DN',$_POST["user"],'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_USER_OBJECT_CLASS',$_POST["objectclass"],'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_USER_OBJECT_CLASS',$_POST["objectclass"],'chaine',0,'',$conf->entity)) $error++;
|
||||||
@@ -68,6 +67,12 @@ if ($_GET["action"] == 'setvalue' && $user->admin)
|
|||||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_DESCRIPTION',$_POST["fielddescription"],'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_DESCRIPTION',$_POST["fielddescription"],'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_SID',$_POST["fieldsid"],'chaine',0,'',$conf->entity)) $error++;
|
if (! dolibarr_set_const($db, 'LDAP_FIELD_SID',$_POST["fieldsid"],'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
|
||||||
|
// This one must be after the others
|
||||||
|
$valkey='';
|
||||||
|
$key=$_POST["key"];
|
||||||
|
if ($key) $valkey=$conf->global->$key;
|
||||||
|
if (! dolibarr_set_const($db, 'LDAP_KEY_USERS',$valkey,'chaine',0,'',$conf->entity)) $error++;
|
||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
dol_print_error($db->error());
|
dol_print_error($db->error());
|
||||||
@@ -156,7 +161,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldFullname").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldFullname").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldfullname" value="'.$conf->global->LDAP_FIELD_FULLNAME.'">';
|
print '<input size="25" type="text" name="fieldfullname" value="'.$conf->global->LDAP_FIELD_FULLNAME.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldFullnameExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldFullnameExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_FIELD_FULLNAME.'"'.($conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_FULLNAME?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_FULLNAME"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_FULLNAME)?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Name
|
// Name
|
||||||
@@ -164,7 +169,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldName").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldName").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldname" value="'.$conf->global->LDAP_FIELD_NAME.'">';
|
print '<input size="25" type="text" name="fieldname" value="'.$conf->global->LDAP_FIELD_NAME.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldNameExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldNameExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_FIELD_NAME.'"'.($conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_NAME?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_NAME"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_NAME)?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Firstname
|
// Firstname
|
||||||
@@ -172,7 +177,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldFirstName").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldFirstName").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldfirstname" value="'.$conf->global->LDAP_FIELD_FIRSTNAME.'">';
|
print '<input size="25" type="text" name="fieldfirstname" value="'.$conf->global->LDAP_FIELD_FIRSTNAME.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldFirstNameExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldFirstNameExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_FIELD_FIRSTNAME.'"'.($conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_FIRSTNAME?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_FIRSTNAME"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_FIRSTNAME)?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Login unix
|
// Login unix
|
||||||
@@ -180,7 +185,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldLoginUnix").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldLoginUnix").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldlogin" value="'.$conf->global->LDAP_FIELD_LOGIN.'">';
|
print '<input size="25" type="text" name="fieldlogin" value="'.$conf->global->LDAP_FIELD_LOGIN.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldLoginExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldLoginExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_FIELD_LOGIN.'"'.($conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_LOGIN?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_LOGIN"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_LOGIN)?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Login samba
|
// Login samba
|
||||||
@@ -188,7 +193,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldLoginSamba").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldLoginSamba").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldloginsamba" value="'.$conf->global->LDAP_FIELD_LOGIN_SAMBA.'">';
|
print '<input size="25" type="text" name="fieldloginsamba" value="'.$conf->global->LDAP_FIELD_LOGIN_SAMBA.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldLoginSambaExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldLoginSambaExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_FIELD_LOGIN_SAMBA.'"'.($conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_LOGIN_SAMBA?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_LOGIN_SAMBA"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_LOGIN_SAMBA)?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Password not crypted
|
// Password not crypted
|
||||||
@@ -196,7 +201,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldPasswordNotCrypted").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldPasswordNotCrypted").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldpassword" value="'.$conf->global->LDAP_FIELD_PASSWORD.'">';
|
print '<input size="25" type="text" name="fieldpassword" value="'.$conf->global->LDAP_FIELD_PASSWORD.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldPasswordExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldPasswordExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_FIELD_PASSWORD.'"'.($conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_PASSWORD?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_PASSWORD"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_PASSWORD)?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Password crypted
|
// Password crypted
|
||||||
@@ -204,7 +209,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldPasswordCrypted").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldPasswordCrypted").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldpasswordcrypted" value="'.$conf->global->LDAP_FIELD_PASSWORD_CRYPTED.'">';
|
print '<input size="25" type="text" name="fieldpasswordcrypted" value="'.$conf->global->LDAP_FIELD_PASSWORD_CRYPTED.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldPasswordExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldPasswordExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_FIELD_PASSWORD_CRYPTED.'"'.($conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_PASSWORD_CRYPTED?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_PASSWORD_CRYPTED"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_PASSWORD_CRYPTED)?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Mail
|
// Mail
|
||||||
@@ -212,7 +217,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldMail").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldMail").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldmail" value="'.$conf->global->LDAP_FIELD_MAIL.'">';
|
print '<input size="25" type="text" name="fieldmail" value="'.$conf->global->LDAP_FIELD_MAIL.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldMailExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldMailExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_FIELD_MAIL.'"'.($conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_MAIL?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_MAIL"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_MAIL)?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Phone
|
// Phone
|
||||||
@@ -220,7 +225,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldPhone").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldPhone").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldphone" value="'.$conf->global->LDAP_FIELD_PHONE.'">';
|
print '<input size="25" type="text" name="fieldphone" value="'.$conf->global->LDAP_FIELD_PHONE.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldPhoneExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldPhoneExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_FIELD_PHONE.'"'.($conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_PHONE?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_PHONE"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_PHONE)?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Mobile
|
// Mobile
|
||||||
@@ -228,7 +233,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldMobile").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldMobile").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldmobile" value="'.$conf->global->LDAP_FIELD_MOBILE.'">';
|
print '<input size="25" type="text" name="fieldmobile" value="'.$conf->global->LDAP_FIELD_MOBILE.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldMobileExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldMobileExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_FIELD_MOBILE.'"'.($conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_MOBILE?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_MOBILE"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_MOBILE)?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Fax
|
// Fax
|
||||||
@@ -236,7 +241,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldFax").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldFax").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldfax" value="'.$conf->global->LDAP_FIELD_FAX.'">';
|
print '<input size="25" type="text" name="fieldfax" value="'.$conf->global->LDAP_FIELD_FAX.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldFaxExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldFaxExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_FIELD_FAX.'"'.($conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_FAX?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_FAX"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_FAX)?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
@@ -244,7 +249,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldDescription").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldDescription").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fielddescription" value="'.$conf->global->LDAP_FIELD_DESCRIPTION.'">';
|
print '<input size="25" type="text" name="fielddescription" value="'.$conf->global->LDAP_FIELD_DESCRIPTION.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldDescriptionExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldDescriptionExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_FIELD_DESCRIPTION.'"'.($conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_DESCRIPTION?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_DESCRIPTION"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_DESCRIPTION)?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Sid
|
// Sid
|
||||||
@@ -252,7 +257,7 @@ $var=!$var;
|
|||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldSid").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldSid").'</td><td>';
|
||||||
print '<input size="25" type="text" name="fieldsid" value="'.$conf->global->LDAP_FIELD_SID.'">';
|
print '<input size="25" type="text" name="fieldsid" value="'.$conf->global->LDAP_FIELD_SID.'">';
|
||||||
print '</td><td>'.$langs->trans("LDAPFieldSidExample").'</td>';
|
print '</td><td>'.$langs->trans("LDAPFieldSidExample").'</td>';
|
||||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_FIELD_SID.'"'.($conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_SID?' checked="true"':'')."></td>";
|
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_SID"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_SID)?' checked="true"':'')."></td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|||||||
@@ -179,9 +179,10 @@ $dolibarr_main_authentication='dolibarr';
|
|||||||
# $dolibarr_main_auth_ldap_servertype='openldap'; # openldap, activedirectory or egroupware
|
# $dolibarr_main_auth_ldap_servertype='openldap'; # openldap, activedirectory or egroupware
|
||||||
# $dolibarr_main_auth_ldap_login_attribute='loginfield'; # uid or samaccountname for active directory
|
# $dolibarr_main_auth_ldap_login_attribute='loginfield'; # uid or samaccountname for active directory
|
||||||
# $dolibarr_main_auth_ldap_dn=''; # Ex: ou=users,dc=my-domain,dc=com
|
# $dolibarr_main_auth_ldap_dn=''; # Ex: ou=users,dc=my-domain,dc=com
|
||||||
|
# $dolibarr_main_auth_ldap_filter = '' # Ex: &(uid=%1%)(isMemberOf=cn=Sales,ou=Groups,dc=opencsi,dc=com)
|
||||||
# $dolibarr_main_auth_ldap_admin_login=''; # Required only if anonymous bind disabled
|
# $dolibarr_main_auth_ldap_admin_login=''; # Required only if anonymous bind disabled
|
||||||
# $dolibarr_main_auth_ldap_admin_pass=''; # Required only if anonymous bind disabled
|
# $dolibarr_main_auth_ldap_admin_pass=''; # Required only if anonymous bind disabled
|
||||||
#
|
|
||||||
# $dolibarr_main_auth_ldap_debug='false';
|
# $dolibarr_main_auth_ldap_debug='false';
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,18 +19,18 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/includes/login/functions_ldap.php
|
* \file htdocs/includes/login/functions_ldap.php
|
||||||
\ingroup core
|
* \ingroup core
|
||||||
\brief Authentication functions for LDAP
|
* \brief Authentication functions for LDAP
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Check user and password
|
* @brief Check user and password
|
||||||
\param usertotest Login
|
* @param usertotest Login
|
||||||
\param passwordtotest Password
|
* @param passwordtotest Password
|
||||||
\return string Login if ok, '' if ko.
|
* @return string Login if ok, '' if ko.
|
||||||
\remarks If test is ko, reason must be filled into $_SESSION["dol_loginmesg"]
|
* @remarks If test is ko, reason must be filled into $_SESSION["dol_loginmesg"]
|
||||||
*/
|
*/
|
||||||
function check_user_password_ldap($usertotest,$passwordtotest)
|
function check_user_password_ldap($usertotest,$passwordtotest)
|
||||||
{
|
{
|
||||||
@@ -90,38 +90,45 @@ function check_user_password_ldap($usertotest,$passwordtotest)
|
|||||||
|
|
||||||
$resultCheckUserDN=false;
|
$resultCheckUserDN=false;
|
||||||
|
|
||||||
|
// Define $userSearchFilter
|
||||||
|
$userSearchFilter = "";
|
||||||
|
if (empty($dolibarr_main_auth_ldap_filter)) {
|
||||||
|
$userSearchFilter = "(" . $ldapuserattr . "=" . $usertotest . ")";
|
||||||
|
} else {
|
||||||
|
$userSearchFilter = str_replace('%1%', $usertotest, $dolibarr_main_auth_ldap_filter);
|
||||||
|
}
|
||||||
|
|
||||||
// If admin login provided
|
// If admin login provided
|
||||||
// Code to get user in LDAP from an admin connection (may differ from Dolibarr user)
|
// Code to get user in LDAP from an admin connection (may differ from user connection, done later)
|
||||||
if ($ldapadminlogin)
|
if ($ldapadminlogin)
|
||||||
{
|
{
|
||||||
$result=$ldap->connect_bind();
|
$result=$ldap->connect_bind();
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$resultFetchLdapUser = $ldap->fetch($_POST["username"]);
|
$resultFetchLdapUser = $ldap->fetch($usertotest,$userSearchFilter);
|
||||||
// On stop si le mot de passe ldap doit etre modifie sur le domaine
|
// On stop si le mot de passe ldap doit etre modifie sur le domaine
|
||||||
if ($resultFetchLdapUser == 1 && $ldap->pwdlastset == 0)
|
if ($resultFetchLdapUser == 1 && $ldap->pwdlastset == 0)
|
||||||
{
|
{
|
||||||
dol_syslog('functions_ldap::check_user_password_ldap '.$_POST["username"].' must change password next logon');
|
dol_syslog('functions_ldap::check_user_password_ldap '.$usertotest.' must change password next logon');
|
||||||
if ($ldapdebug) print "DEBUG: User ".$_POST["username"]." must change password<br>\n";
|
if ($ldapdebug) print "DEBUG: User ".$usertotest." must change password<br>\n";
|
||||||
$ldap->close();
|
$ldap->close();
|
||||||
sleep(1);
|
sleep(1);
|
||||||
$langs->load('ldap');
|
$langs->load('ldap');
|
||||||
$_SESSION["dol_loginmesg"]=$langs->trans("YouMustChangePassNextLogon",$_POST["username"],$ldap->domainFQDN);
|
$_SESSION["dol_loginmesg"]=$langs->trans("YouMustChangePassNextLogon",$usertotest,$ldap->domainFQDN);
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$resultCheckUserDN = $ldap->checkPass($usertotest,$passwordtotest);
|
$resultCheckUserDN = $ldap->checkPass($usertotest,$passwordtotest); // $ldap->ldapUserDN is defined if ok
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$ldap->close();
|
$ldap->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Forge LDAP user and password to test from config setup
|
// Forge LDAP user and password to test with them
|
||||||
$ldap->searchUser=$ldapuserattr."=".$usertotest.",".$ldapdn;
|
$ldap->searchUser=$ldapuserattr."=".$usertotest.",".$ldapdn;
|
||||||
$ldap->searchPassword=$passwordtotest;
|
|
||||||
|
|
||||||
if ($resultCheckUserDN) $ldap->searchUser = $ldap->ldapUserDN;
|
if ($resultCheckUserDN) $ldap->searchUser = $ldap->ldapUserDN;
|
||||||
|
$ldap->searchPassword=$passwordtotest;
|
||||||
|
|
||||||
// Test with this->seachUser and this->searchPassword
|
// Test with this->seachUser and this->searchPassword
|
||||||
$result=$ldap->connect_bind();
|
$result=$ldap->connect_bind();
|
||||||
@@ -130,14 +137,14 @@ function check_user_password_ldap($usertotest,$passwordtotest)
|
|||||||
if ($result == 2)
|
if ($result == 2)
|
||||||
{
|
{
|
||||||
dol_syslog("functions_ldap::check_user_password_ldap Authentification ok");
|
dol_syslog("functions_ldap::check_user_password_ldap Authentification ok");
|
||||||
$login=$_POST["username"];
|
$login=$usertotest;
|
||||||
|
|
||||||
// ldap2dolibarr synchronisation
|
// ldap2dolibarr synchronisation
|
||||||
if ($login && $conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr')
|
if ($login && $conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr')
|
||||||
{
|
{
|
||||||
// On charge les attributs du user ldap
|
// On charge les attributs du user ldap
|
||||||
if ($ldapdebug) print "DEBUG: login ldap = ".$login."<br>\n";
|
if ($ldapdebug) print "DEBUG: login ldap = ".$login."<br>\n";
|
||||||
$ldap->fetch($login);
|
$ldap->fetch($login,$userSearchFilter);
|
||||||
|
|
||||||
if ($ldapdebug) print "DEBUG: UACF = ".join(',',$ldap->uacf)."<br>\n";
|
if ($ldapdebug) print "DEBUG: UACF = ".join(',',$ldap->uacf)."<br>\n";
|
||||||
if ($ldapdebug) print "DEBUG: pwdLastSet = ".dol_print_date($ldap->pwdlastset,'day')."<br>\n";
|
if ($ldapdebug) print "DEBUG: pwdLastSet = ".dol_print_date($ldap->pwdlastset,'day')."<br>\n";
|
||||||
@@ -164,7 +171,7 @@ function check_user_password_ldap($usertotest,$passwordtotest)
|
|||||||
}
|
}
|
||||||
if ($result == 1)
|
if ($result == 1)
|
||||||
{
|
{
|
||||||
dol_syslog("functions_ldap::check_user_password_ldap Authentification ko bad user/password for '".$_POST["username"]."'");
|
dol_syslog("functions_ldap::check_user_password_ldap Authentification ko bad user/password for '".$usertotest."'");
|
||||||
sleep(1);
|
sleep(1);
|
||||||
$langs->load('main');
|
$langs->load('main');
|
||||||
$langs->load('other');
|
$langs->load('other');
|
||||||
@@ -173,7 +180,7 @@ function check_user_password_ldap($usertotest,$passwordtotest)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog("functions_ldap::check_user_password_ldap Authentification ko failed to connect to LDAP for '".$_POST["username"]."'");
|
dol_syslog("functions_ldap::check_user_password_ldap Authentification ko failed to connect to LDAP for '".$usertotest."'");
|
||||||
sleep(1);
|
sleep(1);
|
||||||
$langs->load('main');
|
$langs->load('main');
|
||||||
$langs->load('other');
|
$langs->load('other');
|
||||||
|
|||||||
@@ -1151,11 +1151,13 @@ class Ldap
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Recupere les attributs de l'utilisateur
|
* Load all attribute of a LDAP user
|
||||||
* \param $user Utilisateur ldap a lire
|
* @param $user User to search for. Not used if a filter is provided.
|
||||||
* \return int >0 if ok, <0 if ko
|
* @param filter Filter for search. Must start with &.
|
||||||
|
* Examples: &(objectClass=inetOrgPerson) &(objectClass=user)(objectCategory=person) &(isMemberOf=cn=Sales,ou=Groups,dc=opencsi,dc=com)
|
||||||
|
* @return int >0 if ok, <0 if ko
|
||||||
*/
|
*/
|
||||||
function fetch($user)
|
function fetch($user,$filter)
|
||||||
{
|
{
|
||||||
// Perform the search and get the entry handles
|
// Perform the search and get the entry handles
|
||||||
|
|
||||||
@@ -1163,19 +1165,14 @@ class Ldap
|
|||||||
if ($this->serverType == "activedirectory") {
|
if ($this->serverType == "activedirectory") {
|
||||||
$this->bindauth($this->searchUser, $this->searchPassword);
|
$this->bindauth($this->searchUser, $this->searchPassword);
|
||||||
}
|
}
|
||||||
$userIdentifier = $this->getUserIdentifier();
|
|
||||||
|
|
||||||
$filter = '('.$this->filter.'('.$userIdentifier.'='.$user.'))';
|
|
||||||
|
|
||||||
$i = 0;
|
|
||||||
$searchDN = $this->people;
|
$searchDN = $this->people;
|
||||||
|
|
||||||
$result = '';
|
$result = '';
|
||||||
|
$i=0;
|
||||||
while ($i <= 2)
|
while ($i <= 2)
|
||||||
{
|
{
|
||||||
$this->result = @ldap_search($this->connection, $searchDN, $filter);
|
$this->result = @ldap_search($this->connection, $searchDN, $filter);
|
||||||
|
|
||||||
if ($this->result)
|
if ($this->result)
|
||||||
{
|
{
|
||||||
$result = @ldap_get_entries($this->connection, $this->result);
|
$result = @ldap_get_entries($this->connection, $this->result);
|
||||||
@@ -1195,8 +1192,7 @@ class Ldap
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$i++;
|
break;
|
||||||
$i++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1209,7 +1205,7 @@ class Ldap
|
|||||||
{
|
{
|
||||||
$this->name = $this->convToOutputCharset($result[0][$this->attr_name][0],$this->ldapcharset);
|
$this->name = $this->convToOutputCharset($result[0][$this->attr_name][0],$this->ldapcharset);
|
||||||
$this->firstname = $this->convToOutputCharset($result[0][$this->attr_firstname][0],$this->ldapcharset);
|
$this->firstname = $this->convToOutputCharset($result[0][$this->attr_firstname][0],$this->ldapcharset);
|
||||||
$this->login = $this->convToOutputCharset($result[0][$userIdentifier][0],$this->ldapcharset);
|
$this->login = $this->convToOutputCharset($result[0][$this->attr_login][0],$this->ldapcharset);
|
||||||
$this->phone = $this->convToOutputCharset($result[0][$this->attr_phone][0],$this->ldapcharset);
|
$this->phone = $this->convToOutputCharset($result[0][$this->attr_phone][0],$this->ldapcharset);
|
||||||
$this->fax = $this->convToOutputCharset($result[0][$this->attr_fax][0],$this->ldapcharset);
|
$this->fax = $this->convToOutputCharset($result[0][$this->attr_fax][0],$this->ldapcharset);
|
||||||
$this->mail = $this->convToOutputCharset($result[0][$this->attr_mail][0],$this->ldapcharset);
|
$this->mail = $this->convToOutputCharset($result[0][$this->attr_mail][0],$this->ldapcharset);
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ class User extends CommonObject
|
|||||||
//! Liste des entrepots auquel a acces l'utilisateur
|
//! Liste des entrepots auquel a acces l'utilisateur
|
||||||
var $entrepots;
|
var $entrepots;
|
||||||
|
|
||||||
var $rights;
|
var $rights; // Array of permissions user->rights->permx
|
||||||
var $all_permissions_are_loaded; /**< \private all_permissions_are_loaded */
|
var $all_permissions_are_loaded; /**< \private all_permissions_are_loaded */
|
||||||
var $tab_loaded=array(); // Tableau pour signaler les permissions deja chargees
|
var $tab_loaded=array(); // Tableau pour signaler les permissions deja chargees
|
||||||
|
|
||||||
@@ -1157,7 +1157,7 @@ class User extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function update_last_login_date()
|
function update_last_login_date()
|
||||||
{
|
{
|
||||||
$now=gmmktime();
|
$now=dol_now();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."user SET";
|
||||||
$sql.= " datepreviouslogin = datelastlogin,";
|
$sql.= " datepreviouslogin = datelastlogin,";
|
||||||
@@ -1436,10 +1436,11 @@ class User extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Mise e jour des infos de click to dial
|
* Update clicktodial info
|
||||||
*/
|
*/
|
||||||
function update_clicktodial()
|
function update_clicktodial()
|
||||||
{
|
{
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."user_clicktodial";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."user_clicktodial";
|
||||||
$sql .= " WHERE fk_user = ".$this->id;
|
$sql .= " WHERE fk_user = ".$this->id;
|
||||||
@@ -1457,11 +1458,14 @@ class User extends CommonObject
|
|||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
|
$this->db->commit();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $this->db->error();
|
$this->db->rollback();
|
||||||
|
$this->error=$this->db->error();
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1470,9 +1474,12 @@ class User extends CommonObject
|
|||||||
* Add user into a group
|
* Add user into a group
|
||||||
* @param group id du groupe
|
* @param group id du groupe
|
||||||
*/
|
*/
|
||||||
function SetInGroup($group)
|
function SetInGroup($group, $notrigger=0)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
$error=0;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup_user";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup_user";
|
||||||
$sql.= " WHERE fk_user = ".$this->id;
|
$sql.= " WHERE fk_user = ".$this->id;
|
||||||
@@ -1485,15 +1492,20 @@ class User extends CommonObject
|
|||||||
$sql.= " VALUES (".$conf->entity.",".$this->id.",".$group.")";
|
$sql.= " VALUES (".$conf->entity.",".$this->id.",".$group.")";
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
|
$this->db->commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a user from a group
|
* Remove a user from a group
|
||||||
* @param group id du groupe
|
* @param group id du groupe
|
||||||
*/
|
*/
|
||||||
function RemoveFromGroup($group)
|
function RemoveFromGroup($group, $notrigger=0)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
$error=0;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup_user";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup_user";
|
||||||
$sql.= " WHERE fk_user = ".$this->id;
|
$sql.= " WHERE fk_user = ".$this->id;
|
||||||
@@ -1501,6 +1513,8 @@ class User extends CommonObject
|
|||||||
$sql.= " AND entity = ".$conf->entity;
|
$sql.= " AND entity = ".$conf->entity;
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
|
$this->db->commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -804,7 +804,8 @@ else
|
|||||||
$result=$ldap->connect_bind();
|
$result=$ldap->connect_bind();
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$entries = $ldap->fetch($fuser->login);
|
$userSearchFilter = '('.$conf->global->LDAP_FILTER_CONNECTION.'('.$this->getUserIdentifier().'='.$fuser->login.'))';
|
||||||
|
$entries = $ldap->fetch($fuser->login,$userSearchFilter);
|
||||||
if (! $entries)
|
if (! $entries)
|
||||||
{
|
{
|
||||||
$message .= $ldap->error;
|
$message .= $ldap->error;
|
||||||
|
|||||||
Reference in New Issue
Block a user