Changeset 674096
- Timestamp:
- 02/27/2013 03:14:14 PM (13 years ago)
- Location:
- active-directory-integration/trunk
- Files:
-
- 4 edited
-
ad-integration.php (modified) (2 diffs)
-
ad_ldap/adLDAP.php (modified) (9 diffs)
-
bulkimport.php (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
active-directory-integration/trunk/ad-integration.php
r670744 r674096 656 656 '------------------------------------------'); 657 657 658 if (function_exists('ldap_control_paged_result')) { 659 $this->_log(ADI_LOG_INFO, 'LDAP paging: enabled'); 660 } else { 661 $this->_log(ADI_LOG_INFO, 'LDAP paging: not available'); 662 } 663 658 664 // IMPORTANT! 659 665 $this->_authenticated = false; 660 666 $user_id = NULL; 661 $username = strtolower($username); 667 $username = strtolower($username); 662 668 $password = stripslashes($password); 663 669 … … 2254 2260 update_site_option('AD_Integration_auto_update_user', (bool)$arrPost['AD_Integration_auto_update_user']); 2255 2261 2256 if ( !empty( $arrPost['AD_Integration_auto_update_description'] ) ) 2262 if ( !empty( $arrPost['AD_Integration_network_timeout'] ) ) 2263 update_site_option('AD_Integration_network_timeout', (int)$arrPost['AD_Integration_network_timeout']); 2264 2265 if ( !empty( $arrPost['AD_Integration_auto_update_description'] ) ) 2257 2266 update_site_option('AD_Integration_auto_update_description', (bool)$arrPost['AD_Integration_auto_update_description']); 2258 2267 -
active-directory-integration/trunk/ad_ldap/adLDAP.php
r371867 r674096 16 16 * to benefit the entire community :) 17 17 * 18 * EXTENDED with the ability to change the port and recursive_groups bug fix 19 * by Christoph Steindorff, ECW GmbH 20 * email: cst@ecw.de 21 * http://www.ecw.de 18 * EXTENDED with the ability to change the port, recursive_groups bug fix 19 * and paging support by 20 * Christoph Steindorff 21 * email: christoph@steindorff.de 22 * http://www.steindorff.de 22 23 * 23 24 * This library is free software; you can redistribute it and/or … … 37 38 * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html LGPLv2.1 38 39 * @revision $Revision: 91 $ 39 * @version 3.3.2 EXTENDED (201 102221155)40 * @version 3.3.2 EXTENDED (201302271401) 40 41 * @link http://adldap.sourceforge.net/ 41 42 */ … … 157 158 * @var unknown_type 158 159 */ 159 const VERSION = '3.3.2 E xtended (201104081456)';160 const VERSION = '3.3.2 EXTENDED (201302271401)'; 160 161 161 162 … … 746 747 * @param array $fields 747 748 */ 748 public function group_members_by_primarygroupid($pgid= NULL, $fields = NULL )749 public function group_members_by_primarygroupid($pgid= NULL, $fields = NULL, $recursive = false) 749 750 { 750 751 if (!$this->_bind){ return (false); } 751 752 752 753 if ($pgid===NULL){ return (false); } 753 754 755 $filter="(&(objectCategory=user)(primarygroupid=".$pgid."))"; 756 $sr=ldap_search($this->_conn,$this->_base_dn,$filter,array('dn')); 757 $users = ldap_get_entries($this->_conn, $sr); 754 755 $filter="(&(objectCategory=user)(primarygroupid=".$pgid."))"; 756 757 // Let's use paging if available 758 if (function_exists('ldap_control_paged_result')) { 759 760 $pageSize = 500; 761 $cookie = ''; 762 $users = array(); 763 $users_page = array(); 764 765 do { 766 ldap_control_paged_result($this->_conn, $pageSize, true, $cookie); 767 768 $sr = ldap_search($this->_conn, $this->_base_dn, $filter, array('dn')); 769 $users_page = ldap_get_entries($this->_conn, $sr); 770 771 if (!is_array($users_page)) { 772 return false; 773 } 774 775 $users = array_merge($users, $users_page); 776 ldap_control_paged_result_response($this->_conn, $sr, $cookie); 777 778 } while($cookie !== null && $cookie != ''); 779 780 $users['count'] = count($users) -1; // Set a new count value !important! 781 782 ldap_control_paged_result($this->_conn, $pageSize, true, $cookie); // RESET is important 783 784 } else { 785 786 // Non-Paged version 787 $sr = ldap_search($this->_conn, $this->_base_dn, $filter, array('dn')); 788 $users = ldap_get_entries($this->_conn, $sr); 789 } 758 790 759 791 if (!is_array($users)) { 760 792 return (false); 761 793 } 762 794 763 795 $user_array=array(); 764 796 765 797 for ($i=0; $i<$users["count"]; $i++){ 766 798 $filter="(&(objectCategory=person)(distinguishedName=".$this->ldap_slashes($users[$i]['dn'])."))"; 799 767 800 $fields = array("samaccountname", "distinguishedname", "objectClass"); 768 $sr =ldap_search($this->_conn,$this->_base_dn,$filter,$fields);801 $sr = ldap_search($this->_conn, $this->_base_dn, $filter, $fields); 769 802 $entries = ldap_get_entries($this->_conn, $sr); 770 803 … … 796 829 return ($user_array); 797 830 } 798 831 799 832 800 833 … … 810 843 811 844 if ($recursive===NULL){ $recursive=$this->_recursive_groups; } // Use the default option if they haven't set it 845 812 846 // Search the directory for the members of a group 813 847 $info=$this->group_info($group,array("member","cn")); … … 820 854 return (false); 821 855 } 856 822 857 823 858 $user_array=array(); … … 856 891 } 857 892 893 858 894 /** 859 895 * Group Information. Returns an array of information about a group. … … 875 911 //echo ($filter."!!!<br>"); 876 912 if ($fields===NULL){ $fields=array("member","memberof","cn","description","distinguishedname","objectcategory","samaccountname"); } 877 $sr=ldap_search($this->_conn,$this->_base_dn,$filter,$fields); 878 $entries = ldap_get_entries($this->_conn, $sr); 913 914 // Let's use paging if available 915 if (function_exists('ldap_control_paged_result')) { 916 917 $pageSize = 500; 918 $cookie = ''; 919 $entries = array(); 920 $entries_page = array(); 921 922 do { 923 ldap_control_paged_result($this->_conn, $pageSize, true, $cookie); 924 925 $sr=ldap_search($this->_conn,$this->_base_dn,$filter,$fields); 926 $entries_page = ldap_get_entries($this->_conn, $sr); 927 928 if (!is_array($entries_page)) { 929 return (false); 930 } 931 932 $entries = array_merge($entries, $entries_page); 933 ldap_control_paged_result_response($this->_conn, $sr, $cookie); 934 935 } while($cookie !== null && $cookie != ''); 936 937 $entries['count'] = count($entries) - 1; // Set a new count value !important! 938 939 ldap_control_paged_result($this->_conn, $pageSize, true, $cookie); // RESET is important 940 941 } else { 942 943 // Non-Paged version 944 $sr=ldap_search($this->_conn,$this->_base_dn,$filter,$fields); 945 $entries = ldap_get_entries($this->_conn, $sr); 946 } 947 879 948 //print_r($entries); 880 949 return ($entries); -
active-directory-integration/trunk/bulkimport.php
r670753 r674096 254 254 foreach ($all_users AS $username) { 255 255 256 $ad_username = $username; 256 $ad_username = $username; // Issue #0077 257 257 258 258 // getting user data 259 //$user = get_userdatabylogin($username); // deprecated260 259 $user = get_user_by('login', $username); 260 //$ad_username = get_user_meta($user->ID, 'adi_samaccountname', true); // Issue #0077 261 261 262 262 // role -
active-directory-integration/trunk/readme.txt
r670753 r674096 36 36 * Using LDAP_OPT_NETWORK_TIMEOUT (default 5 seconds) to fall back to local authorization when your Active Directory Server is unreachable. 37 37 * Bulk SyncBack to manually write all "Additional User Attributes" back to Active Directory. 38 * **NEW** Disable user accounts in WordPress if they are disabled in Active Directory. 39 * **NEW** Option to disable fallback to local (WordPress) authentication. 38 * Disable user accounts in WordPress if they are disabled in Active Directory. 39 * Option to disable fallback to local (WordPress) authentication. 40 * **NEW** Support for large groups (>1000 user) in Bulk Import with PHP 5.4.0 and above. 40 41 41 42 The latest major release 1.1 was sponsored by [VARA](http://vara.nl). Many thanks to Bas Ruijters. … … 98 99 = Why will no users be imported if I'm using "Domain Users" as security group for Bulk Import? = 99 100 Here we have a special problem with the builtin security group "Domain Users". In detail: the security group "Domain Users" is usually the primary group of all users. In this case the members of this security group are not listed in the members attribute of the group. To import all users of the security group "Domain Users" you must set the option "Import members of security groups" to "**Domain Users;id:513**". The part "id:513" means "Import all users whos primaryGroupID is 513." And as you might have guessed, 513 is the ID of the security group "Domain Users". 101 102 = I have problems with accounts that have special characters in the username. What can I do? = 103 It is never a good idea to allow special characters in usernames! For ADI it won't be a problem, but in Wordpress only lowercase letters (a-z) and numbers are allowed. The only option is to change the usernames in AD. Hey! Stop! Don't shoot the messenger. 100 104 101 105 = I'm interested in the further development of ADI. How to keep up to date? = … … 128 132 == Changelog == 129 133 130 = 1.1.4 = 131 * Fix: Bulk Import didn't work correctly if account suffix is appended to username. (Bug report by Stephen. Issue #0076.) 132 * Change: Moved class BulkSyncBackADIntegrationPlugin() from syncback.php to BulkSyncBackADIntegrationPlugin.class.php (Recommendation by nic0tin. Issue #0075.) 134 = 1.1.5 = 135 * ADD: LDAP paging support for Bulk Import on PHP 5.4.0 so more than 1000 users per group can be imported. (Issue #0058. Thanks to billrod for the bug report.) 136 * Fix: Added network_timeout setting to wpmu settings. 137 * Fix: Bulk Import didn't work correctly if account suffix is appended to username. (Issue #0076. Thanks to Stephen Rice for the bug report.) 138 * Change: Moved class BulkSyncBackADIntegrationPlugin() from syncback.php to BulkSyncBackADIntegrationPlugin.class.php (Recommendation by nic0tin. Issue #0075.) 139 133 140 134 141 = 1.1.4 =
Note: See TracChangeset
for help on using the changeset viewer.