28require
'../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/class/ldap.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/ldap.lib.php';
42$langs->loadLangs(array(
'users',
'admin',
'companies',
'ldap'));
45$action =
GETPOST(
'action',
'aZ09');
46$contextpage =
GETPOST(
'contextpage',
'aZ') ?:
'userldap';
50if ($user->socid > 0) {
51 $socid = $user->socid;
53$feature2 = (($socid && $user->hasRight(
'user',
'self',
'creer')) ?
'' :
'user');
56$hookmanager->initHooks(array(
'usercard',
'userldap',
'globalcard'));
58$result =
restrictedArea($user,
'user', $id,
'user&user', $feature2);
70$parameters = array(
'id'=>$socid);
71$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
77 if ($action ==
'dolibarr2ldap') {
79 $result = $ldap->connectBind();
82 $info =
$object->_load_ldap_info();
83 $dn =
$object->_load_ldap_dn($info);
86 $result = $ldap->update($dn, $info, $user, $olddn);
101$form =
new Form($db);
104$title = $person_name.
" - ".$langs->trans(
'LDAP');
106llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-ldap');
110$title = $langs->trans(
"User");
115if ($user->hasRight(
'user',
'user',
'lire') || !empty($user->admin)) {
116 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
119dol_banner_tab($object,
'id', $linkback, $user->hasRight(
'user',
'user',
'lire') || $user->admin);
121print
'<div class="fichecenter">';
122print
'<div class="underbanner clearboth"></div>';
124print
'<table class="border centpercent tableforfield">';
127print
'<tr><td class="titlefield">'.$langs->trans(
"Login").
'</td>';
129 print
'<td class="warning">'.$langs->trans(
"LoginAccountDisableInDolibarr").
'</td>';
131 print
'<td>'.$object->login.
'</td>';
137 $result = $ldap->connectBind();
140 $userSID = $ldap->getObjectSid(
$object->login);
142 print
'<tr><td class="valigntop">'.$langs->trans(
"SID").
'</td>';
143 print
'<td>'.$userSID.
'</td>';
148print
'<tr><td>LDAP '.$langs->trans(
"LDAPUserDn").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_USER_DN').
"</td></tr>\n";
151print
'<tr><td>LDAP '.$langs->trans(
"LDAPNamingAttribute").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_KEY_USERS').
"</td></tr>\n";
154print
'<tr><td>LDAP '.$langs->trans(
"Type").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_SERVER_TYPE').
"</td></tr>\n";
155print
'<tr><td>LDAP '.$langs->trans(
"Version").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_SERVER_PROTOCOLVERSION').
"</td></tr>\n";
156print
'<tr><td>LDAP '.$langs->trans(
"LDAPPrimaryServer").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_SERVER_HOST').
"</td></tr>\n";
157print
'<tr><td>LDAP '.$langs->trans(
"LDAPSecondaryServer").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_SERVER_HOST_SLAVE').
"</td></tr>\n";
158print
'<tr><td>LDAP '.$langs->trans(
"LDAPServerPort").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_SERVER_PORT').
"</td></tr>\n";
169print
'<div class="tabsAction">';
171if (
getDolGlobalInt(
'LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
172 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=dolibarr2ldap">'.$langs->trans(
"ForceSynchronize").
'</a>';
177if (
getDolGlobalInt(
'LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
186print
'<table class="noborder centpercent">';
188print
'<tr class="liste_titre">';
189print
'<td>'.$langs->trans(
"LDAPAttributes").
'</td>';
190print
'<td>'.$langs->trans(
"Value").
'</td>';
195$result = $ldap->connectBind();
197 $info =
$object->_load_ldap_info();
198 $dn =
$object->_load_ldap_dn($info, 1);
199 $search =
"(".$object->_load_ldap_dn($info, 2).
")";
201 $records = $ldap->getAttribute($dn, $search);
206 if (((!is_numeric($records)) || $records != 0) && (!isset($records[
'count']) || $records[
'count'] > 0)) {
207 if (!is_array($records)) {
208 print
'<tr class="oddeven"><td colspan="2"><span class="error">'.$langs->trans(
"ErrorFailedToReadLDAP").
'</span></td></tr>';
218 print
'<tr class="oddeven"><td colspan="2"><span class="error">'.$langs->trans(
"ErrorFailedToReadLDAP").
'</span></td></tr>';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage LDAP features.
Class to manage Dolibarr users.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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 a 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.
getDolGlobalString($key, $default='')
Return a 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.