Changeset 563 for trunk/jabberit_messenger/inc/class.ldap_im.inc.php
- Timestamp:
- 01/05/09 09:25:35 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/jabberit_messenger/inc/class.ldap_im.inc.php
r551 r563 25 25 private $jid; 26 26 private $max_result; 27 private $ou_User; 27 28 28 29 public final function __construct() 29 30 { 30 $this->ldap_host = $_SESSION['phpgw_info']['jabberit_messenger']['server_ldap_jabberit'];31 $this->ldap_context = $_SESSION['phpgw_info']['jabberit_messenger']['context_ldap_jabberit'];32 $this->ldap_dn = $_SESSION['phpgw_info']['jabberit_messenger']['user_ldap_jabberit'];33 $this->ldap_pass = $_SESSION['phpgw_info']['jabberit_messenger']['password_ldap_jabberit'];31 $this->ldap_host = (isset($_SESSION['phpgw_info']['jabberit_messenger']['server_ldap_jabberit'])) ? $_SESSION['phpgw_info']['jabberit_messenger']['server_ldap_jabberit'] : $GLOBALS['phpgw_info']['server']['ldap_host']; 32 $this->ldap_context = (isset($_SESSION['phpgw_info']['jabberit_messenger']['context_ldap_jabberit'])) ? $_SESSION['phpgw_info']['jabberit_messenger']['context_ldap_jabberit'] : $GLOBALS['phpgw_info']['server']['ldap_context']; 33 $this->ldap_dn = (isset($_SESSION['phpgw_info']['jabberit_messenger']['user_ldap_jabberit'])) ? $_SESSION['phpgw_info']['jabberit_messenger']['user_ldap_jabberit'] : $GLOBALS['phpgw_info']['server']['ldap_root_dn']; 34 $this->ldap_pass = (isset($_SESSION['phpgw_info']['jabberit_messenger']['password_ldap_jabberit'])) ? $_SESSION['phpgw_info']['jabberit_messenger']['password_ldap_jabberit'] : $GLOBALS['phpgw_info']['server']['ldap_root_pw']; 34 35 $this->jid = $_SESSION['phpgw_info']['jabberit_messenger']['user']; 35 36 $this->max_result = 50; 37 38 // Ou User 39 $this->ou_User = $_SESSION['phpgw_info']['jabberit_messenger']['account_dn']; 40 $this->ou_User = substr($this->ou_User,strpos($this->ou_User, "ou=")); 41 $this->ou_User = strtoupper(substr($this->ou_User, 0, strpos($this->ou_User, ",dc="))); 36 42 } 37 43 … … 49 55 { 50 56 $GLOBALS['phpgw_info']['server']['ldap_version3'] = true; 51 $this->ldap = $this->common->ldapConnect( $this->ldap_host,$this->ldap_dn,$this->ldap_pass, true );57 $this->ldap = $this->common->ldapConnect( $this->ldap_host,$this->ldap_dn,$this->ldap_pass, false ); 52 58 } 53 59 } … … 150 156 } 151 157 152 public final function list_users_ldap($search, $uidnumber )158 public final function list_users_ldap($search, $uidnumber, $groupsDeny) 153 159 { 154 160 $this->_connect_ldap(); … … 159 165 $justthese = array("uid","uidNumber","cn","mail","phpgwAccountVisible","dn","jpegPhoto"); 160 166 // SERPRO 161 //$justthese = array("uid","uidNumber","cn","mail","description","phpgwAccountVisible","dn","jpegPhoto"); 162 $search = ldap_search($this->ldap,$this->ldap_context,$filter,$justthese, 0, $this->max_result + 1); 167 //$justthese = array("uid","uidNumber","cn","mail","description","phpgwAccountVisible","dn","jpegPhoto"); 168 if( $groupsDeny ) 169 $search = ldap_search($this->ldap,$this->ou_User.",".$this->ldap_context,$filter,$justthese, 0, $this->max_result + 1); 170 else 171 $search = ldap_search($this->ldap,$this->ldap_context,$filter,$justthese, 0, $this->max_result + 1); 163 172 $entry1 = ldap_get_entries($this->ldap,$search); 164 173 $entry = ldap_first_entry( $this->ldap, $search ); … … 243 252 } 244 253 245 public final function list_organizations_ldap() 246 { 247 $result_org = "<organizations>"; 254 public final function listOrganizationsLdap() 255 { 248 256 249 257 $this->_connect_ldap(); … … 259 267 foreach($entry as $tmp) 260 268 if($tmp['ou'][0] != "") 261 $result_org .= "<ou>" . $tmp['ou'][0] . "</ou>"; 262 263 $result_org .= "</organizations>"; 264 269 $result_org[] = $tmp['ou'][0]; 270 265 271 return $result_org; 266 272 } 273 274 public final function getGroupsLdap($pOrg) 275 { 276 $this->_ldapConnect(true); 277 $organization = 'ou=' . $pOrg['ou'] .",". $this->ldap_context; 278 279 if( $this->ldap ) 280 { 281 $filter = "(&(phpgwAccountType=g)(objectClass=posixGroup))"; 282 $justthese = array("cn","gidNumber"); 283 $search = ldap_list($this->ldap, $organization, $filter, $justthese); 284 $entry = ldap_get_entries( $this->ldap, $search ); 285 286 if( $entry ) 287 { 288 $result_groups = "<ldap>"; 289 foreach($entry as $tmp) 290 if( $tmp['gidnumber'][0] != "" ) 291 $result_groups .= "<org><cn>".$tmp['cn'][0]."</cn><gid>".$tmp['gidnumber'][0]."</gid></org>"; 292 293 $result_groups .= "</ldap>"; 294 } 295 } 296 297 return $result_groups; 298 } 299 267 300 } 268 301
Note: See TracChangeset
for help on using the changeset viewer.