Go to the documentation of this file.
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 $action =
GETPOST(
'action',
'aZ09');
35 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'userldap';
39 if ($user->socid > 0) {
40 $socid = $user->socid;
42 $feature2 = (($socid && $user->rights->user->self->creer) ?
'' :
'user');
44 $result =
restrictedArea($user,
'user', $id,
'user&user', $feature2);
46 $object =
new User($db);
47 $object->fetch($id,
'',
'', 1);
51 $hookmanager->initHooks(array(
'usercard',
'userldap',
'globalcard'));
59 $parameters = array(
'id'=>$socid);
60 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
65 if (empty($reshook)) {
66 if ($action ==
'dolibarr2ldap') {
68 $result = $ldap->connect_bind();
71 $info = $object->_load_ldap_info();
72 $dn = $object->_load_ldap_dn($info);
75 $result = $ldap->update($dn, $info, $user, $olddn);
96 $title = $langs->trans(
"User");
101 if (!empty($user->rights->user->user->lire) || !empty($user->admin)) {
102 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
105 dol_banner_tab($object,
'id', $linkback, $user->rights->user->user->lire || $user->admin);
107 print
'<div class="fichecenter">';
108 print
'<div class="underbanner clearboth"></div>';
110 print
'<table class="border centpercent tableforfield">';
113 print
'<tr><td class="titlefield">'.$langs->trans(
"Login").
'</td>';
114 if ($object->ldap_sid) {
115 print
'<td class="warning">'.$langs->trans(
"LoginAccountDisableInDolibarr").
'</td>';
117 print
'<td>'.$object->login.
'</td>';
121 if ($conf->global->LDAP_SERVER_TYPE ==
"activedirectory") {
123 $result = $ldap->connect_bind();
125 $userSID = $ldap->getObjectSid($object->login);
127 print
'<tr><td class="valigntop">'.$langs->trans(
"SID").
'</td>';
128 print
'<td>'.$userSID.
'</td>';
133 print
'<tr><td>LDAP '.$langs->trans(
"LDAPUserDn").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_USER_DN').
"</td></tr>\n";
136 print
'<tr><td>LDAP '.$langs->trans(
"LDAPNamingAttribute").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_KEY_USERS').
"</td></tr>\n";
139 print
'<tr><td>LDAP '.$langs->trans(
"Type").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_SERVER_TYPE').
"</td></tr>\n";
140 print
'<tr><td>LDAP '.$langs->trans(
"Version").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_SERVER_PROTOCOLVERSION').
"</td></tr>\n";
141 print
'<tr><td>LDAP '.$langs->trans(
"LDAPPrimaryServer").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_SERVER_HOST').
"</td></tr>\n";
142 print
'<tr><td>LDAP '.$langs->trans(
"LDAPSecondaryServer").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_SERVER_HOST_SLAVE').
"</td></tr>\n";
143 print
'<tr><td>LDAP '.$langs->trans(
"LDAPServerPort").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_SERVER_PORT').
"</td></tr>\n";
154 print
'<div class="tabsAction">';
157 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=dolibarr2ldap">'.$langs->trans(
"ForceSynchronize").
'</a>';
171 print
'<table class="noborder centpercent">';
173 print
'<tr class="liste_titre">';
174 print
'<td>'.$langs->trans(
"LDAPAttributes").
'</td>';
175 print
'<td>'.$langs->trans(
"Value").
'</td>';
180 $result = $ldap->connect_bind();
182 $info = $object->_load_ldap_info();
183 $dn = $object->_load_ldap_dn($info, 1);
184 $search =
"(".$object->_load_ldap_dn($info, 2).
")";
186 $records = $ldap->getAttribute($dn, $search);
191 if (((!is_numeric($records)) || $records != 0) && (!isset($records[
'count']) || $records[
'count'] > 0)) {
192 if (!is_array($records)) {
193 print
'<tr class="oddeven"><td colspan="2"><span class="error">'.$langs->trans(
"ErrorFailedToReadLDAP").
'</span></td></tr>';
Class to manage LDAP features.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
restrictedArea($user, $features, $objectid=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.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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.
const SYNCHRO_DOLIBARR_TO_LDAP
Dolibarr to Ldap synchronization.
show_ldap_content($result, $level, $count, $var, $hide=0, $subcount=0)
Show a LDAP array into an HTML output array.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Class to manage Dolibarr users.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.