26 require
'../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/class/ldap.class.php';
29 require_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';
40 if ($user->socid > 0) {
41 $socid = $user->socid;
43 $feature2 = (($socid && $user->rights->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);
66 if (empty($reshook)) {
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");
105 if (!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>';
109 dol_banner_tab($object,
'id', $linkback, $user->rights->user->user->lire || $user->admin);
111 print
'<div class="fichecenter">';
112 print
'<div class="underbanner clearboth"></div>';
114 print
'<table class="border centpercent tableforfield">';
117 print
'<tr><td class="titlefield">'.$langs->trans(
"Login").
'</td>';
118 if ($object->ldap_sid) {
119 print
'<td class="warning">'.$langs->trans(
"LoginAccountDisableInDolibarr").
'</td>';
121 print
'<td>'.$object->login.
'</td>';
125 if ($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>';
137 print
'<tr><td>LDAP '.$langs->trans(
"LDAPUserDn").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_USER_DN').
"</td></tr>\n";
140 print
'<tr><td>LDAP '.$langs->trans(
"LDAPNamingAttribute").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_KEY_USERS').
"</td></tr>\n";
143 print
'<tr><td>LDAP '.$langs->trans(
"Type").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_SERVER_TYPE').
"</td></tr>\n";
144 print
'<tr><td>LDAP '.$langs->trans(
"Version").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_SERVER_PROTOCOLVERSION').
"</td></tr>\n";
145 print
'<tr><td>LDAP '.$langs->trans(
"LDAPPrimaryServer").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_SERVER_HOST').
"</td></tr>\n";
146 print
'<tr><td>LDAP '.$langs->trans(
"LDAPSecondaryServer").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_SERVER_HOST_SLAVE').
"</td></tr>\n";
147 print
'<tr><td>LDAP '.$langs->trans(
"LDAPServerPort").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_SERVER_PORT').
"</td></tr>\n";
158 print
'<div class="tabsAction">';
161 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=dolibarr2ldap">'.$langs->trans(
"ForceSynchronize").
'</a>';
175 print
'<table class="noborder centpercent">';
177 print
'<tr class="liste_titre">';
178 print
'<td>'.$langs->trans(
"LDAPAttributes").
'</td>';
179 print
'<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(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
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.
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.
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='')
Show tabs of a record.
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
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.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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.