25 require
'../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/class/ldap.class.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/ldap.lib.php';
31 $langs->loadLangs(array(
'users',
'admin',
'companies',
'ldap'));
34 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'userldap';
38 if ($user->socid > 0) $socid = $user->socid;
39 $feature2 = (($socid && $user->rights->user->self->creer) ?
'' :
'user');
41 $result =
restrictedArea($user,
'user', $id,
'user&user', $feature2);
43 $object =
new User($db);
44 $object->fetch($id,
'',
'', 1);
48 $hookmanager->initHooks(array(
'usercard',
'userldap',
'globalcard'));
56 $parameters = array(
'id'=>$socid);
57 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
58 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
62 if ($_GET[
"action"] ==
'dolibarr2ldap')
65 $result = $ldap->connect_bind();
69 $info = $object->_load_ldap_info();
70 $dn = $object->_load_ldap_dn($info);
73 $result = $ldap->update($dn, $info, $user, $olddn);
88 $form =
new Form($db);
94 $title = $langs->trans(
"User");
99 if ($user->rights->user->user->lire || $user->admin) {
100 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
103 dol_banner_tab($object,
'id', $linkback, $user->rights->user->user->lire || $user->admin);
105 print '<div class="fichecenter">';
106 print '<div class="underbanner clearboth"></div>';
108 print '<table class="border centpercent">';
111 print '<tr><td class="titlefield">'.$langs->trans(
"Login").
'</td>';
112 if ($object->ldap_sid)
114 print '<td class="warning">'.$langs->trans(
"LoginAccountDisableInDolibarr").
'</td>';
116 print '<td>'.$object->login.
'</td>';
120 if ($conf->global->LDAP_SERVER_TYPE ==
"activedirectory")
123 $result = $ldap->connect_bind();
126 $userSID = $ldap->getObjectSid($object->login);
128 print '<tr><td class="valigntop">'.$langs->trans(
"SID").
'</td>';
129 print '<td>'.$userSID.
'</td>';
134 print '<tr><td>LDAP '.$langs->trans(
"LDAPUserDn").
'</td><td class="valeur">'.$conf->global->LDAP_USER_DN.
"</td></tr>\n";
137 print '<tr><td>LDAP '.$langs->trans(
"LDAPNamingAttribute").
'</td><td class="valeur">'.$conf->global->LDAP_KEY_USERS.
"</td></tr>\n";
140 print '<tr><td>LDAP '.$langs->trans(
"Type").
'</td><td class="valeur">'.$conf->global->LDAP_SERVER_TYPE.
"</td></tr>\n";
141 print '<tr><td>LDAP '.$langs->trans(
"Version").
'</td><td class="valeur">'.$conf->global->LDAP_SERVER_PROTOCOLVERSION.
"</td></tr>\n";
142 print '<tr><td>LDAP '.$langs->trans(
"LDAPPrimaryServer").
'</td><td class="valeur">'.$conf->global->LDAP_SERVER_HOST.
"</td></tr>\n";
143 print '<tr><td>LDAP '.$langs->trans(
"LDAPSecondaryServer").
'</td><td class="valeur">'.$conf->global->LDAP_SERVER_HOST_SLAVE.
"</td></tr>\n";
144 print '<tr><td>LDAP '.$langs->trans(
"LDAPServerPort").
'</td><td class="valeur">'.$conf->global->LDAP_SERVER_PORT.
"</td></tr>\n";
156 print '<div class="tabsAction">';
158 if ($conf->global->LDAP_SYNCHRO_ACTIVE ==
'dolibarr2ldap')
160 print '<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=dolibarr2ldap">'.$langs->trans(
"ForceSynchronize").
'</a>';
165 if ($conf->global->LDAP_SYNCHRO_ACTIVE ==
'dolibarr2ldap')
print "<br>\n";
172 print '<table class="noborder centpercent">';
174 print
'<tr class="liste_titre">';
175 print
'<td>'.$langs->trans(
"LDAPAttributes").
'</td>';
176 print
'<td>'.$langs->trans(
"Value").
'</td>';
181 $result = $ldap->connect_bind();
184 $info = $object->_load_ldap_info();
185 $dn = $object->_load_ldap_dn($info, 1);
186 $search =
"(".$object->_load_ldap_dn($info, 2).
")";
188 $records = $ldap->getAttribute($dn, $search);
193 if (((!is_numeric($records)) || $records != 0) && (!isset($records[
'count']) || $records[
'count'] > 0))
195 if (!is_array($records))
197 print
'<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans(
"ErrorFailedToReadLDAP").
'</font></td></tr>';
202 print
'<tr class="oddeven"><td colspan="2">'.$langs->trans(
"LDAPRecordNotFound").
' (dn='.$dn.
' - search='.$search.
')</td></tr>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
user_prepare_head($object)
Prepare array with list of tabs.
Class to manage Dolibarr users.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
show_ldap_content($result, $level, $count, $var, $hide=0, $subcount=0)
Show a LDAP array into an HTML output array.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
Class to manage LDAP features.
print
Draft customers invoices.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.