Go to the documentation of this file.
26 require
'../../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
28 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/ldap.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/ldap.lib.php';
34 $langs->loadLangs(array(
'companies',
'ldap',
'users',
'admin'));
37 $action =
GETPOST(
'action',
'aZ09');
40 if ($user->socid > 0) {
41 $socid = $user->socid;
44 $object =
new Usergroup($db);
49 if (!empty($conf->multicompany->enabled) && $conf->entity > 1 && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
54 if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
55 $canreadperms = (!empty($user->admin) || !empty($user->rights->user->group_advance->read));
63 if ($action ==
'dolibarr2ldap') {
65 $result = $ldap->connect_bind();
68 $info = $object->_load_ldap_info();
71 if (empty($info[$conf->global->LDAP_GROUP_FIELD_GROUPID]) && in_array(
'posixGroup', $info[
'objectclass'])) {
72 $info[
'gidNumber'] = $ldap->getNextGroupGid(
'LDAP_KEY_GROUPS');
75 $dn = $object->_load_ldap_dn($info);
78 $result = $ldap->update($dn, $info, $user, $olddn);
101 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/group/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
103 dol_banner_tab($object,
'id', $linkback, (!empty($user->rights->user->user->lire) || !empty($user->admin)));
105 print
'<div class="fichecenter">';
106 print
'<div class="underbanner clearboth"></div>';
108 print
'<table class="border centpercent">';
111 if (!empty($conf->mutlicompany->enabled)) {
112 print
'<tr><td class="titlefield">'.$langs->trans(
"Name").
'</td>';
113 print
'<td class="valeur">'.$object->name;
114 if (!$object->entity) {
115 print
img_picto($langs->trans(
"GlobalGroup"),
'redstar');
117 print
"</td></tr>\n";
121 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
122 print
'<td class="valeur sensiblehtmlcontent">';
128 print
'<tr><td>LDAP '.$langs->trans(
"LDAPGroupDn").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_GROUP_DN').
"</td></tr>\n";
131 print
'<tr><td>LDAP '.$langs->trans(
"LDAPNamingAttribute").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_KEY_GROUPS').
"</td></tr>\n";
134 print
'<tr><td>LDAP '.$langs->trans(
"LDAPPrimaryServer").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_SERVER_HOST').
"</td></tr>\n";
135 print
'<tr><td>LDAP '.$langs->trans(
"LDAPSecondaryServer").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_SERVER_HOST_SLAVE').
"</td></tr>\n";
136 print
'<tr><td>LDAP '.$langs->trans(
"LDAPServerPort").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_SERVER_PORT').
"</td></tr>\n";
148 print
'<div class="tabsAction">';
151 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=dolibarr2ldap">'.$langs->trans(
"ForceSynchronize").
'</a>';
165 print
'<table class="noborder centpercent">';
167 print
'<tr class="liste_titre">';
168 print
'<td>'.$langs->trans(
"LDAPAttributes").
'</td>';
169 print
'<td>'.$langs->trans(
"Value").
'</td>';
174 $result = $ldap->connect_bind();
176 $info = $object->_load_ldap_info();
177 $dn = $object->_load_ldap_dn($info, 1);
178 $search =
"(".$object->_load_ldap_dn($info, 2).
")";
180 $records = $ldap->getAttribute($dn, $search);
185 if (((!is_numeric($records)) || $records != 0) && (!isset($records[
'count']) || $records[
'count'] > 0)) {
186 if (!is_array($records)) {
187 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.
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.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
show_ldap_content($result, $level, $count, $var, $hide=0, $subcount=0)
Show a LDAP array into an HTML output array.
group_prepare_head($object)
Prepare array with list of tabs.
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.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles=1, $removeclassattribute=1, $cleanalsojavascript=0, $allowiframe=0)
Clean a string to keep only desirable HTML tags.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.