Changeset 397 for trunk/phpgwapi
- Timestamp:
- 08/14/08 11:46:29 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpgwapi/inc/class.accounts_ldap.inc.php
r367 r397 56 56 if(($acct_type == 'g') && $this->group_context) 57 57 { 58 $sri = @ldap_search($this->ds, $this->user_context, ("(&(gidnumber=" . (int)$this->account_id.")(phpgwaccounttype=g))")); 59 } 60 else 61 { 62 $sri = @ldap_search($this->ds, $this->group_context, ("(&(uidnumber=" . (int)$this->account_id.")(phpgwaccounttype=u))")); 58 /* jakjr: using justthese with ldap_search */ 59 $justthese = array("gidnumber", "cn"); 60 $sri = @ldap_search($this->ds, $this->group_context, ("(&(gidnumber=" . (int)$this->account_id.")(phpgwaccounttype=g))"), $justthese); 61 } 62 else 63 { 64 /* jakjr: using justthese with ldap_search */ 65 $justthese = array("uidnumber", "gidnumber", "uid", "cn", "givenname", "sn", "mail", "phpgwaccountstatus", "phpgwaccountexpires", "phpgwaccounttype"); 66 $sri = @ldap_search($this->ds, $this->user_context, ("(&(uidnumber=" . (int)$this->account_id.")(phpgwaccounttype=u))"), $justthese); 63 67 } 64 68 if(!$sri) … … 85 89 $this->data['email'] = $allValues[0]['mail'][0]; 86 90 } 91 /* jakjr: this is not used for expressoLivre */ 92 /* 93 $this->data['telephonenumber'] = $allValues[0]['telephonenumber'][0]; 94 $this->data['lastlogin'] = $allValues[0]['phpgwaccountlastlogin'][0]; 95 $this->data['lastloginfrom'] = $allValues[0]['phpgwaccountlastloginfrom'][0]; 96 $this->data['lastpasswd_change'] = @$allValues[0]['phpgwlastpasswdchange'][0]; 97 */ 98 $this->data['status'] = trim($allValues[0]['phpgwaccountstatus'][0]); 99 $this->data['expires'] = $allValues[0]['phpgwaccountexpires'][0]; 100 $this->data['type'] = $allValues[0]['phpgwaccounttype'][0]; 87 101 } 88 102 $this->data['account_dn'] = $allValues[0]['dn']; 89 103 $this->data['fullname'] = $GLOBALS['phpgw']->translation->convert($allValues[0]['cn'][0],'utf-8'); 90 104 105 /* jakjr: this is not used for expressoLivre */ 106 /* 91 107 if ($GLOBALS['phpgw_info']['server']['ldap_extra_attributes']) 92 108 { … … 94 110 $this->data['loginshell'] = $allValues[0]['loginshell'][0]; 95 111 } 96 97 $this->data['telephonenumber'] = $allValues[0]['telephonenumber'][0]; 98 $this->data['lastlogin'] = $allValues[0]['phpgwaccountlastlogin'][0]; 99 $this->data['lastloginfrom'] = $allValues[0]['phpgwaccountlastloginfrom'][0]; 100 $this->data['lastpasswd_change'] = @$allValues[0]['phpgwlastpasswdchange'][0]; 101 $this->data['status'] = trim($allValues[0]['phpgwaccountstatus'][0]); 102 $this->data['type'] = $allValues[0]['phpgwaccounttype'][0]; 103 $this->data['expires'] = $allValues[0]['phpgwaccountexpires'][0]; 104 112 */ 105 113 return $this->data; 106 114 } … … 578 586 function name2id($name,$which='account_lid') 579 587 { 580 if ($which == 'account_lid') // groups only support account_lid 581 { 582 $sri = ldap_search($this->ds, $this->group_context, '(&(cn=' . (string)$name . ')(phpgwaccounttype=g))'); 583 $allValues = ldap_get_entries($this->ds, $sri); 584 585 if (@$allValues[0]['gidnumber'][0]) 586 { 587 return (int)$allValues[0]['gidnumber'][0]; 588 } 589 } 588 /* jakjr: change search position */ 590 589 $to_ldap = array( 591 590 'account_lid' => 'uid', … … 593 592 ); 594 593 if (!isset($to_ldap[$which])) return False; 595 596 $sri = ldap_search($this->ds, $this->user_context, '(&('.$to_ldap[$which].'=' . (string)$name . ')(phpgwaccounttype=u))'); 597 594 595 $sri = ldap_search($this->ds, $this->user_context, '(&('.$to_ldap[$which].'=' . (string)$name . ')(phpgwaccounttype=u))', array("uidnumber")); 598 596 $allValues = ldap_get_entries($this->ds, $sri); 599 597 … … 603 601 } 604 602 603 if ($which == 'account_lid') // groups only support account_lid 604 { 605 $sri = ldap_search($this->ds, $this->group_context, '(&(cn=' . (string)$name . ')(phpgwaccounttype=g))', array("gidnumber")); 606 $allValues = ldap_get_entries($this->ds, $sri); 607 608 if (@$allValues[0]['gidnumber'][0]) 609 { 610 return (int)$allValues[0]['gidnumber'][0]; 611 } 612 } 613 605 614 return False; 606 615 } … … 611 620 { 612 621 $allValues = array(); 613 $sri = @ldap_search($this->ds, $this->group_context, '(&(gidnumber=' . (int)$account_id . ')(phpgwaccounttype=g))'); 622 /* jakjr: using justthese with ldap_search */ 623 $sri = @ldap_search($this->ds, $this->group_context, '(&(gidnumber=' . (int)$account_id . ')(phpgwaccounttype=g))', array("cn")); 614 624 if(!$sri) 615 625 return False; … … 632 642 633 643 $allValues = array(); 634 $sri = @ldap_search($this->ds, $this->user_context, '(&(uidnumber=' . (int)$account_id . ')(phpgwaccounttype=u))'); 644 /* jakjr: using justthese with ldap_search */ 645 $justthese = array("uid","mail","surname","cn","phpgwaccounttype"); 646 $sri = @ldap_search($this->ds, $this->user_context, '(&(uidnumber=' . (int)$account_id . ')(phpgwaccounttype=u))', $justthese); 635 647 if(!$sri) 636 648 return False; … … 647 659 { 648 660 $allValues = array(); 649 $sri = @ldap_search($this->ds, $this->user_context, '(&(uidnumber=' . (int)$account_id . ')(phpgwaccounttype=u))'); 661 /* jakjr: using justthese with ldap_search */ 662 $sri = @ldap_search($this->ds, $this->user_context, '(&(uidnumber=' . (int)$account_id . ')(phpgwaccounttype=u))', array("phpgwaccounttype")); 650 663 if(!$sri) 651 664 return False; … … 658 671 659 672 $allValues = array(); 660 $sri = @ldap_search($this->ds, $this->group_context, '(&(gidnumber=' . (int)$account_id . ')(phpgwaccounttype=g))'); 673 /* jakjr: using justthese with ldap_search */ 674 $sri = @ldap_search($this->ds, $this->group_context, '(&(gidnumber=' . (int)$account_id . ')(phpgwaccounttype=g))', array("phpgwaccounttype")); 661 675 if(!$sri) 662 676 return False; … … 1084 1098 $acct_type = $this->get_type($account_id); 1085 1099 1100 /* jakjr: using justthese with ldap_search */ 1101 $justthese = array("cn","uid","givename","sn"); 1102 1086 1103 /* search the dn for the given uid */ 1087 1104 if(($acct_type == 'g') && $this->group_context) 1088 1105 { 1089 $sri = @ldap_search($this->ds, $this->group_context, '(&(gidnumber=' . (int)$account_id . ')(phpgwAccountType=g))' );1090 } 1091 else 1092 { 1093 $sri = @ldap_search($this->ds, $this->user_context, ' uidnumber=' . (int)$account_id);1106 $sri = @ldap_search($this->ds, $this->group_context, '(&(gidnumber=' . (int)$account_id . ')(phpgwAccountType=g))', $justthese); 1107 } 1108 else 1109 { 1110 $sri = @ldap_search($this->ds, $this->user_context, '(&(gidnumber=' . (int)$account_id . ')(phpgwAccountType=g))', $justthese); 1094 1111 } 1095 1112 if(!$sri)
Note: See TracChangeset
for help on using the changeset viewer.