26require
'../main.inc.php';
27require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/class/ldap.class.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/ldap.lib.php';
32$langs->loadLangs(array(
'users',
'admin',
'companies',
'ldap'));
35$action =
GETPOST(
'action',
'aZ09');
36$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'userldap';
40if ($user->socid > 0) {
41 $socid = $user->socid;
43$feature2 = (($socid && $user->hasRight(
'user',
'self',
'creer')) ?
'' :
'user');
45$result =
restrictedArea($user,
'user', $id,
'user&user', $feature2);
47$object =
new User($db);
48$object->fetch($id,
'',
'', 1);
52$hookmanager->initHooks(array(
'usercard',
'userldap',
'globalcard'));
60$parameters = array(
'id'=>$socid);
61$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
67 if ($action ==
'dolibarr2ldap') {
69 $result = $ldap->connect_bind();
72 $info = $object->_load_ldap_info();
73 $dn = $object->_load_ldap_dn($info);
76 $result = $ldap->update($dn, $info, $user, $olddn);
93$person_name = !empty($object->firstname) ? $object->lastname.
", ".$object->firstname : $object->lastname;
94$title = $person_name.
" - ".$langs->trans(
'LDAP');
100$title = $langs->trans(
"User");
105if (!empty($user->rights->user->user->lire) || !empty($user->admin)) {
106 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
109dol_banner_tab($object,
'id', $linkback, $user->rights->user->user->lire || $user->admin);
111print
'<div class="fichecenter">';
112print
'<div class="underbanner clearboth"></div>';
114print
'<table class="border centpercent tableforfield">';
117print
'<tr><td class="titlefield">'.$langs->trans(
"Login").
'</td>';
118if ($object->ldap_sid) {
119 print
'<td class="warning">'.$langs->trans(
"LoginAccountDisableInDolibarr").
'</td>';
121 print
'<td>'.$object->login.
'</td>';
125if ($conf->global->LDAP_SERVER_TYPE ==
"activedirectory") {
127 $result = $ldap->connect_bind();
129 $userSID = $ldap->getObjectSid($object->login);
131 print
'<tr><td class="valigntop">'.$langs->trans(
"SID").
'</td>';
132 print
'<td>'.$userSID.
'</td>';
137print
'<tr><td>LDAP '.$langs->trans(
"LDAPUserDn").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_USER_DN').
"</td></tr>\n";
140print
'<tr><td>LDAP '.$langs->trans(
"LDAPNamingAttribute").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_KEY_USERS').
"</td></tr>\n";
143print
'<tr><td>LDAP '.$langs->trans(
"Type").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_SERVER_TYPE').
"</td></tr>\n";
144print
'<tr><td>LDAP '.$langs->trans(
"Version").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_SERVER_PROTOCOLVERSION').
"</td></tr>\n";
145print
'<tr><td>LDAP '.$langs->trans(
"LDAPPrimaryServer").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_SERVER_HOST').
"</td></tr>\n";
146print
'<tr><td>LDAP '.$langs->trans(
"LDAPSecondaryServer").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_SERVER_HOST_SLAVE').
"</td></tr>\n";
147print
'<tr><td>LDAP '.$langs->trans(
"LDAPServerPort").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_SERVER_PORT').
"</td></tr>\n";
158print
'<div class="tabsAction">';
161 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=dolibarr2ldap">'.$langs->trans(
"ForceSynchronize").
'</a>';
175print
'<table class="noborder centpercent">';
177print
'<tr class="liste_titre">';
178print
'<td>'.$langs->trans(
"LDAPAttributes").
'</td>';
179print
'<td>'.$langs->trans(
"Value").
'</td>';
184$result = $ldap->connect_bind();
186 $info = $object->_load_ldap_info();
187 $dn = $object->_load_ldap_dn($info, 1);
188 $search =
"(".$object->_load_ldap_dn($info, 2).
")";
190 $records = $ldap->getAttribute($dn, $search);
195 if (((!is_numeric($records)) || $records != 0) && (!isset($records[
'count']) || $records[
'count'] > 0)) {
196 if (!is_array($records)) {
197 print
'<tr class="oddeven"><td colspan="2"><span class="error">'.$langs->trans(
"ErrorFailedToReadLDAP").
'</span></td></tr>';
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage LDAP features.
const SYNCHRO_DOLIBARR_TO_LDAP
Dolibarr to Ldap synchronization.
Class to manage Dolibarr users.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
show_ldap_content($result, $level, $count, $var, $hide=0, $subcount=0)
Show a LDAP array into an HTML output array.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
user_prepare_head(User $object)
Prepare array with list of tabs.