27 require
'../../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/class/ldap.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/ldap.lib.php';
35 $langs->loadLangs(array(
'companies',
'ldap',
'users',
'admin'));
38 $action =
GETPOST(
'action',
'aZ09');
41 if ($user->socid > 0) {
42 $socid = $user->socid;
45 $object =
new Usergroup($db);
50 if (
isModEnabled(
'multicompany') && $conf->entity > 1 && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
55 if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
56 $canreadperms = (!empty($user->admin) || !empty($user->rights->user->group_advance->read));
64 if ($action ==
'dolibarr2ldap') {
66 $result = $ldap->connect_bind();
69 $info = $object->_load_ldap_info();
72 if (empty($info[$conf->global->LDAP_GROUP_FIELD_GROUPID]) && in_array(
'posixGroup', $info[
'objectclass'])) {
73 $info[
'gidNumber'] = $ldap->getNextGroupGid(
'LDAP_KEY_GROUPS');
76 $dn = $object->_load_ldap_dn($info);
79 $result = $ldap->update($dn, $info, $user, $olddn);
96 $title = $object->name.
" - ".$langs->trans(
'LDAP');
104 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/group/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
106 dol_banner_tab($object,
'id', $linkback, (!empty($user->rights->user->user->lire) || !empty($user->admin)));
108 print
'<div class="fichecenter">';
109 print
'<div class="underbanner clearboth"></div>';
111 print
'<table class="border centpercent tableforfield">';
114 if (!empty($conf->mutlicompany->enabled)) {
115 print
'<tr><td class="titlefield">'.$langs->trans(
"Name").
'</td>';
116 print
'<td class="valeur">'.$object->name;
117 if (!$object->entity) {
118 print
img_picto($langs->trans(
"GlobalGroup"),
'redstar');
120 print
"</td></tr>\n";
124 print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td>';
125 print
'<td class="valeur sensiblehtmlcontent">';
131 print
'<tr><td>LDAP '.$langs->trans(
"LDAPGroupDn").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_GROUP_DN').
"</td></tr>\n";
134 print
'<tr><td>LDAP '.$langs->trans(
"LDAPNamingAttribute").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_KEY_GROUPS').
"</td></tr>\n";
137 print
'<tr><td>LDAP '.$langs->trans(
"LDAPPrimaryServer").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_SERVER_HOST').
"</td></tr>\n";
138 print
'<tr><td>LDAP '.$langs->trans(
"LDAPSecondaryServer").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_SERVER_HOST_SLAVE').
"</td></tr>\n";
139 print
'<tr><td>LDAP '.$langs->trans(
"LDAPServerPort").
'</td><td class="valeur">'.
getDolGlobalString(
'LDAP_SERVER_PORT').
"</td></tr>\n";
151 print
'<div class="tabsAction">';
154 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=dolibarr2ldap">'.$langs->trans(
"ForceSynchronize").
'</a>';
168 print
'<table class="noborder centpercent">';
170 print
'<tr class="liste_titre">';
171 print
'<td>'.$langs->trans(
"LDAPAttributes").
'</td>';
172 print
'<td>'.$langs->trans(
"Value").
'</td>';
177 $result = $ldap->connect_bind();
179 $info = $object->_load_ldap_info();
180 $dn = $object->_load_ldap_dn($info, 1);
181 $search =
"(".$object->_load_ldap_dn($info, 2).
")";
183 $records = $ldap->getAttribute($dn, $search);
188 if (((!is_numeric($records)) || $records != 0) && (!isset($records[
'count']) || $records[
'count'] > 0)) {
189 if (!is_array($records)) {
190 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.
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.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles=1, $removeclassattribute=1, $cleanalsojavascript=0, $allowiframe=0, $allowed_tags=array())
Clean a string to keep only desirable HTML tags.
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.
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...
isModEnabled($module)
Is Dolibarr module enabled.
show_ldap_content($result, $level, $count, $var, $hide=0, $subcount=0)
Show a LDAP array into an HTML output array.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
group_prepare_head($object)
Prepare array with list of tabs.