* Copyright (C) 2006 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ * $Source$ */ /** \file htdocs/user/ldap.php \ingroup ldap \brief Page fiche LDAP utilisateur \version $Revision$ */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/usergroups.lib.php"); require_once (DOL_DOCUMENT_ROOT."/lib/authldap.lib.php"); $user->getrights('commercial'); $langs->load("companies"); $langs->load("ldap"); // Protection quand utilisateur externe $contactid = isset($_GET["id"])?$_GET["id"]:''; $socid=0; if ($user->societe_id > 0) { $socid = $user->societe_id; } /* * Affichage page */ llxHeader(); $form = new Form($db); $fuser = new User($db, $_GET["id"]); $fuser->fetch(); $fuser->getrights(); /* * Affichage onglets */ $head = user_prepare_head($fuser); dolibarr_fiche_head($head, 'ldap', $langs->trans("User").": ".$fuser->fullname); /* * Fiche en mode visu */ print ''; // Ref print ''; print ''; print ''; // Nom print ''; print ''; print "\n"; // Prenom print ''; print ''; print "\n"; // Login print ''; if ($fuser->ldap_sid) { print ''; } else { print ''; } print ''; print '
'.$langs->trans("Ref").''.$fuser->id.'
'.$langs->trans("Lastname").''.$fuser->nom.'
'.$langs->trans("Firstname").''.$fuser->prenom.'
'.$langs->trans("Login").''.$langs->trans("LoginAccountDisableInDolibarr").''.$fuser->login.'
'; print ''; print '
'; print_titre($langs->trans("LDAPInformationsForThisUser")); // Affichage attributs LDAP print ''; print ''; print ''; print ''; print ''; // Lecture LDAP $ldap=new AuthLdap(); $result=$ldap->connect(); if ($result) { $bind=''; if ($conf->global->LDAP_ADMIN_DN && $conf->global->LDAP_ADMIN_PASS) { dolibarr_syslog("ldap.php: authBind user=".$conf->global->LDAP_ADMIN_DN,LOG_DEBUG); $bind=$ldap->authBind($conf->global->LDAP_ADMIN_DN,$conf->global->LDAP_ADMIN_PASS); } else { dolibarr_syslog("ldap.php: bind",LOG_DEBUG); $bind=$ldap->bind(); } if ($bind) { // $info["cn"] = $ldap->getUserIdentifier()."=".$fuser->uname; $info["cn"] = trim($fuser->prenom." ".$fuser->nom); $dn = "cn=".$info["cn"].",".$conf->global->LDAP_USER_DN; $result=$ldap->search($dn,'(objectClass=*)'); // Affichage arbre if (sizeof($result)) { $html=new Form($db); $html->show_ldap_content($result,0,0,true); } else { print ''; } } else { dolibarr_print_error('',$ldap); } } else { dolibarr_print_error('',$ldap); } print '
'.$langs->trans("LDAPAttributes").''.$langs->trans("Value").'
'.$langs->trans("LDAPRecordNotFound").'
'; $db->close(); llxFooter('$Date$ - $Revision$'); ?>