You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(7) |
Jul
(5) |
Aug
(1) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
|
Feb
(5) |
Mar
(9) |
Apr
(5) |
May
(3) |
Jun
(2) |
Jul
(9) |
Aug
(4) |
Sep
(1) |
Oct
(1) |
Nov
(1) |
Dec
|
2010 |
Jan
(5) |
Feb
(1) |
Mar
|
Apr
(1) |
May
(3) |
Jun
(5) |
Jul
(1) |
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2011 |
Jan
|
Feb
(3) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <axe...@us...> - 2009-08-20 15:08:38
|
Revision: 96 http://wpmu-ldap.svn.sourceforge.net/wpmu-ldap/?rev=96&view=rev Author: axelseaa Date: 2009-08-20 15:08:25 +0000 (Thu, 20 Aug 2009) Log Message: ----------- oops - checked in the wrong version, here is the correct one Modified Paths: -------------- trunk/ldap/lib/wpmu_ldap.functions.php Modified: trunk/ldap/lib/wpmu_ldap.functions.php =================================================================== --- trunk/ldap/lib/wpmu_ldap.functions.php 2009-08-20 14:51:51 UTC (rev 95) +++ trunk/ldap/lib/wpmu_ldap.functions.php 2009-08-20 15:08:25 UTC (rev 96) @@ -289,25 +289,7 @@ } function wpmuLdapUsernamePasswordAuthenticate($user, $username, $password) { - // account exists - check for local user - if ( is_a($user, 'WP_User') ) { - $ldap_login = get_usermeta($user->ID,'ldap_login'); - - // Try for local login - if ($ldap_login != true || $ldap_login != 'true') { - if ( !$user || ($user->user_login != $username) ) { - do_action( 'wp_login_failed', $username ); - return new WP_Error('invalid_username', __('<strong>ERROR</strong>: Invalid username.')); - } - - if ( !wp_check_password($password, $user->user_pass, $user->ID) ) { - do_action( 'wp_login_failed', $username ); - return new WP_Error('incorrect_password', __('<strong>ERROR</strong>: Incorrect password.')); - } - - return $user; - } - } + if ( is_a($user, 'WP_User') ) return $user; // check that username and password are not empty if ( (empty($username) || empty($password)) ) { @@ -328,7 +310,7 @@ } function wpmuLdapSSOAuthenticate($user, $username, $password) { - if ( is_a($user, 'WP_User') ) { return $user; } + if ( is_a($user, 'WP_User') ) return $user; // only try SSO if we have not just logged out and // we're not trying to log in with a different username This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <axe...@us...> - 2009-08-20 14:51:59
|
Revision: 95 http://wpmu-ldap.svn.sourceforge.net/wpmu-ldap/?rev=95&view=rev Author: axelseaa Date: 2009-08-20 14:51:51 +0000 (Thu, 20 Aug 2009) Log Message: ----------- revamped login process - now uses the authentication hook - thanks bforchhammer Modified Paths: -------------- trunk/ldap/lib/wpmu_ldap.functions.php trunk/ldap_auth.php Modified: trunk/ldap/lib/wpmu_ldap.functions.php =================================================================== --- trunk/ldap/lib/wpmu_ldap.functions.php 2009-08-20 14:49:39 UTC (rev 94) +++ trunk/ldap/lib/wpmu_ldap.functions.php 2009-08-20 14:51:51 UTC (rev 95) @@ -274,17 +274,8 @@ return $result; } -function ldapSSOAuthenticate($username, $password) { - if ( empty($_GET['loggedout']) // we have not just logged out - && !wp_validate_auth_cookie() // we do not have a cookie - && empty($username) ) { // and we're not already trying to log in with a different username - $username = "[LDAP_SSO]"; - $password = "[LDAP_SSO]"; - } -} - /** -* +* Checks to make sure the user is added to the dashboard blog (if set) or else blog #1 */ function wpmuUpdateBlogAccess($userid) { // reset primary blog to #1 (or dashboard) and add subscriber role @@ -296,3 +287,105 @@ update_usermeta($userid, "primary_blog", 1); } } + +function wpmuLdapUsernamePasswordAuthenticate($user, $username, $password) { + // account exists - check for local user + if ( is_a($user, 'WP_User') ) { + $ldap_login = get_usermeta($user->ID,'ldap_login'); + + // Try for local login + if ($ldap_login != true || $ldap_login != 'true') { + if ( !$user || ($user->user_login != $username) ) { + do_action( 'wp_login_failed', $username ); + return new WP_Error('invalid_username', __('<strong>ERROR</strong>: Invalid username.')); + } + + if ( !wp_check_password($password, $user->user_pass, $user->ID) ) { + do_action( 'wp_login_failed', $username ); + return new WP_Error('incorrect_password', __('<strong>ERROR</strong>: Incorrect password.')); + } + + return $user; + } + } + + // check that username and password are not empty + if ( (empty($username) || empty($password)) ) { + return $user; // probably an WP_Error object, set in "wp_authenticate_username_password()" + } + + // setup ldap string + $ldapString = wpmuSetupLdapOptions(); + + // Authenticate via LDAP, potentially creating a WP user + $ldapauthresult = wpmuLdapAuthenticate($ldapString, $username, $password); + + if ($ldapauthresult['result']) { + return wpmuLdapProcess($user, $username, $password, $ldapauthresult['userdata']); + } else { + return $ldapauthresult['errors']; + } +} + +function wpmuLdapSSOAuthenticate($user, $username, $password) { + if ( is_a($user, 'WP_User') ) { return $user; } + + // only try SSO if we have not just logged out and + // we're not trying to log in with a different username + if ( empty($username) && empty($password) && empty($_GET['loggedout'])) { + $username = wpmuLdapSSOGetUsername(); + if (empty($username)) return $user; // can't log in without a username + + //$password = wp_generate_password(); //create a random password for the local user + + $ldapString = wpmuSetupLdapOptions(); + $userDataArray = null; + $result = wpmuLdapSearch($ldapString,$username,$userDataArray); + $ldapauthresult = array('result' => $result, 'userdata' => $userDataArray); + + if ($ldapauthresult['result']) { + return wpmuLdapProcess($user, $username, $password, $ldapauthresult['userdata']); + } else { + return new WP_Error('sso_failed', sprintf(__('Single Sign-On as user <em>%s</em> failed. Please login using the form below.'),$username)); + } + } + + return $user; +} + +/** + * Retrieve username from server variable for Single Sign-On. + * + * The variable is taken from one of these three variables: + * + * - AUTH_USER: The name of the user as it is derived from the authorization + * header sent by the client, before the user name is mapped to a Windows + * account. This variable is no different from REMOTE_USER. If you have an + * authentication filter installed on your Web server that maps incoming users + * to accounts, use LOGON_USER to view the mapped user name. + * + * - LOGON_USER: The Windows account that the user is impersonating while + * connected to your Web server. Use REMOTE_USER or AUTH_USER to view the raw + * user name that is contained in the request header. The only time LOGON_USER + * holds a different value than these other variables is if you have an + * authentication filter installed. + * + * - REMOTE_USER: The name of the user as it is derived from the authorization + * header sent by the client, before the user name is mapped to a Windows + * account. If you have an authentication filter installed on your Web server + * hat maps incoming users to accounts, use LOGON_USER to view the mapped user + * name. + */ +function wpmuLdapSSOGetUsername() { + $username = ''; + if (!empty($_SERVER['LOGON_USER'])) $username = $_SERVER['LOGON_USER']; + elseif (!empty($_SERVER['REMOTE_USER'])) $username = $_SERVER['REMOTE_USER']; + elseif(!empty($_SERVER['AUTH_USER'])) $username = $_SERVER['AUTH_USER']; + + // strip user account domain + if (strpos($username, '\\\\') !== FALSE) { + $username = substr($username, strpos($username, '\\\\') + 2); + } + + return $username; +} Modified: trunk/ldap_auth.php =================================================================== --- trunk/ldap_auth.php 2009-08-20 14:49:39 UTC (rev 94) +++ trunk/ldap_auth.php 2009-08-20 14:51:51 UTC (rev 95) @@ -3,7 +3,7 @@ Plugin Name: LDAP Authentication Plug-in Plugin URI: http://wpmuldap.frozenpc.net Description: A plugin to override the core Wordpress MU authentication method so as to use an LDAP server for authentication. -Version: 2.8.2 +Version: 2.8.4 Author: Alistair Young (http://www.weblogs.uhi.ac.uk/sm00ay/), Patrick Cavit (http://patcavit.com), Hugo Salgado (http://hugo.vulcano.cl), @@ -43,119 +43,17 @@ add_action('login_head', 'wpmuLdapDisableSignupMessage'); } - if (get_site_option('ldapSSOEnabled')) add_action('wp_authenticate', 'ldapSSOAuthenticate', 10, 2); - // only include them if it's active, so as to cut down on continual parsing of the code require_once("ldap/lib/wpmu_ldap.functions.php"); + // Authentication filters + add_action('authenticate', 'wpmuLdapUsernamePasswordAuthenticate', 25, 3); + if (get_site_option('ldapSSOEnabled')) add_action('authenticate', 'wpmuLdapSSOAuthenticate', 40, 3); + // disable only for ldap accounts add_filter('show_password_fields', 'wpmuLdapDisableLdapPassword'); // disable default add user box add_filter('show_adduser_fields', 'wpmuLdapDisableShowUser'); - function wp_authenticate($username,$password) { - // Necessary to stop error message from display on first page load - if (empty($username)) return new WP_Error(); - - $isSSO = ($username == '[LDAP_SSO]'); - if ($isSSO) { - /* - AUTH_USER: The name of the user as it is derived from the authorization - header sent by the client, before the user name is mapped to a Windows - account. This variable is no different from REMOTE_USER. If you have an - authentication filter installed on your Web server that maps incoming users - to accounts, use LOGON_USER to view the mapped user name. - - LOGON_USER: The Windows account that the user is impersonating while - connected to your Web server. Use REMOTE_USER or AUTH_USER to view the raw - user name that is contained in the request header. The only time LOGON_USER - holds a different value than these other variables is if you have an - authentication filter installed. - - REMOTE_USER: The name of the user as it is derived from the authorization - header sent by the client, before the user name is mapped to a Windows - account. If you have an authentication filter installed on your Web server - that maps incoming users to accounts, use LOGON_USER to view the mapped user - name. - */ - $sso_user = ''; - if (!empty($_SERVER['LOGON_USER'])) - $sso_user = $_SERVER['LOGON_USER']; - elseif (!empty($_SERVER['REMOTE_USER'])) - $sso_user = $_SERVER['REMOTE_USER']; - elseif(!empty($_SERVER['AUTH_USER'])) - $sso_user = $_SERVER['AUTH_USER']; - - // strip user account domain - if (strpos($sso_user, '\\\\') !== FALSE) { - $sso_user = substr($sso_user, strpos($sso_user, '\\\\') + 2); - } - if (!empty($sso_user)) { - $username = $sso_user; - $password = wp_generate_password(); //create a random password for the local user - } else { - $isSSO = false; - } - } - - // make sure we always use lowercase usernames - $username = strtolower($username); - $username = sanitize_user($username); - - // Is Ldap enabled? - $ldapAuth = get_site_option("ldapAuth"); - - // setup ldap string - $ldapString = wpmuSetupLdapOptions(); - - // try finding a WP account for this user name - $user = get_userdatabylogin($username); - - // if username exists, lets check and see if they are already logged in - if ($user != false) { - $ldap_login = get_usermeta($user->ID,'ldap_login'); - - //Setup redirection to users home directory. - if (!strpos($_REQUEST['redirect_to'], $username)) { - $_REQUEST['redirect_to'] = $username . "/" . $_REQUEST['redirect_to']; - } - - // Try for local login - if ($ldap_login != true || $ldap_login != 'true') { - if ( !$user || ($user->user_login != $username) ) { - do_action( 'wp_login_failed', $username ); - return new WP_Error('invalid_username', __('<strong>ERROR</strong>: Invalid username.')); - } - - if ( !wp_check_password($password, $user->user_pass, $user->ID) ) { - do_action( 'wp_login_failed', $username ); - return new WP_Error('incorrect_password', __('<strong>ERROR</strong>: Incorrect password.')); - } - wpmuUpdateBlogAccess($user->ID); - - return new WP_User($user->ID); - } - } - - if ($isSSO) { - // search for user and retrieve user data - $ldapString = wpmuSetupLdapOptions(); - $userDataArray = null; - $result = wpmuLdapSearch($ldapString,$username,$userDataArray); - $ldapauthresult = array('result' => $result, 'userdata' => $userDataArray); - } else { - // Authenticate via LDAP, potentially creating a WP user - $ldapauthresult = wpmuLdapAuthenticate($ldapString, $username, $password); - } - - if ($ldapauthresult['result']) { - return wpmuLdapProcess($user, $username, $password, $ldapauthresult['userdata']); - } elseif ($isSSO) { - return new WP_Error('sso_failed', sprintf(__('Single Sign-On as user <em>%s</em> failed. Please login using the form below.'),$username)); - } else { - return $ldapauthresult['errors']; - } - } } -?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <axe...@us...> - 2009-08-20 14:49:47
|
Revision: 94 http://wpmu-ldap.svn.sourceforge.net/wpmu-ldap/?rev=94&view=rev Author: axelseaa Date: 2009-08-20 14:49:39 +0000 (Thu, 20 Aug 2009) Log Message: ----------- fix for password reset not working on local accounts Modified Paths: -------------- trunk/ldap/lib/wpmu_ldap_admin.functions.php Modified: trunk/ldap/lib/wpmu_ldap_admin.functions.php =================================================================== --- trunk/ldap/lib/wpmu_ldap_admin.functions.php 2009-08-12 17:25:12 UTC (rev 93) +++ trunk/ldap/lib/wpmu_ldap_admin.functions.php 2009-08-20 14:49:39 UTC (rev 94) @@ -585,6 +585,7 @@ */ function ldapPasswordReset($value,$userID) { $ldap_login = get_usermeta($userID, 'ldap_login'); + if (empty($ldap_login)) return true; if ($ldap_login == true) { // get the configurable error message: return new WP_Error('no_password_reset', __("<strong>ERROR</strong>: ").get_site_option('ldapGetPasswordMessage')); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <axe...@us...> - 2009-08-12 17:25:18
|
Revision: 93 http://wpmu-ldap.svn.sourceforge.net/wpmu-ldap/?rev=93&view=rev Author: axelseaa Date: 2009-08-12 17:25:12 +0000 (Wed, 12 Aug 2009) Log Message: ----------- corrected improper constant definitions - fixes 2833638 Modified Paths: -------------- trunk/ldap/lib/ldap_core.php Modified: trunk/ldap/lib/ldap_core.php =================================================================== --- trunk/ldap/lib/ldap_core.php 2009-07-27 14:52:24 UTC (rev 92) +++ trunk/ldap/lib/ldap_core.php 2009-08-12 17:25:12 UTC (rev 93) @@ -2,12 +2,12 @@ require_once ("defines.php"); // Indices into the server information string -define (SERVER_NAME, '0'); -define (SEARCH_BASE, '1'); -define (PRIV_DN, '2'); -define (PRIV_PASSWD, '3'); -define (SERVER_PORT, '4'); -define (ENABLE_SSL, '5'); +define ('SERVER_NAME', '0'); +define ('SEARCH_BASE', '1'); +define ('PRIV_DN', '2'); +define ('PRIV_PASSWD', '3'); +define ('SERVER_PORT', '4'); +define ('ENABLE_SSL', '5'); class LDAP { var $server; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <axe...@us...> - 2009-07-27 14:52:34
|
Revision: 92 http://wpmu-ldap.svn.sourceforge.net/wpmu-ldap/?rev=92&view=rev Author: axelseaa Date: 2009-07-27 14:52:24 +0000 (Mon, 27 Jul 2009) Log Message: ----------- fixed warning (function was not in the include file loaded at action call Modified Paths: -------------- trunk/ldap/lib/wpmu_ldap.functions.php trunk/ldap/lib/wpmu_ldap_admin.functions.php Modified: trunk/ldap/lib/wpmu_ldap.functions.php =================================================================== --- trunk/ldap/lib/wpmu_ldap.functions.php 2009-07-21 02:17:30 UTC (rev 91) +++ trunk/ldap/lib/wpmu_ldap.functions.php 2009-07-27 14:52:24 UTC (rev 92) @@ -296,11 +296,3 @@ update_usermeta($userid, "primary_blog", 1); } } -/** -* Remove the Add New menu item added in 2.7 -*/ -function wpmuRemoveAddNewMenu() { - global $submenu; - unset($submenu['users.php'][10]); -} - Modified: trunk/ldap/lib/wpmu_ldap_admin.functions.php =================================================================== --- trunk/ldap/lib/wpmu_ldap_admin.functions.php 2009-07-21 02:17:30 UTC (rev 91) +++ trunk/ldap/lib/wpmu_ldap_admin.functions.php 2009-07-27 14:52:24 UTC (rev 92) @@ -758,3 +758,11 @@ } // wpmuUserFormLdapOptionUpdate() +/** +* Remove the Add New menu item added in 2.7 +*/ +function wpmuRemoveAddNewMenu() { + global $submenu; + unset($submenu['users.php'][10]); +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <axe...@us...> - 2009-07-21 02:17:30
|
Revision: 91 http://wpmu-ldap.svn.sourceforge.net/wpmu-ldap/?rev=91&view=rev Author: axelseaa Date: 2009-07-21 02:17:30 +0000 (Tue, 21 Jul 2009) Log Message: ----------- new release Added Paths: ----------- tags/wpmu-ldap_2.8.2/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <axe...@us...> - 2009-07-21 02:17:09
|
Revision: 90 http://wpmu-ldap.svn.sourceforge.net/wpmu-ldap/?rev=90&view=rev Author: axelseaa Date: 2009-07-21 02:17:00 +0000 (Tue, 21 Jul 2009) Log Message: ----------- bump revision Modified Paths: -------------- trunk/ldap_auth.php Modified: trunk/ldap_auth.php =================================================================== --- trunk/ldap_auth.php 2009-07-20 14:46:18 UTC (rev 89) +++ trunk/ldap_auth.php 2009-07-21 02:17:00 UTC (rev 90) @@ -3,7 +3,7 @@ Plugin Name: LDAP Authentication Plug-in Plugin URI: http://wpmuldap.frozenpc.net Description: A plugin to override the core Wordpress MU authentication method so as to use an LDAP server for authentication. -Version: 2.8.1 +Version: 2.8.2 Author: Alistair Young (http://www.weblogs.uhi.ac.uk/sm00ay/), Patrick Cavit (http://patcavit.com), Hugo Salgado (http://hugo.vulcano.cl), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <axe...@us...> - 2009-07-20 14:46:26
|
Revision: 89 http://wpmu-ldap.svn.sourceforge.net/wpmu-ldap/?rev=89&view=rev Author: axelseaa Date: 2009-07-20 14:46:18 +0000 (Mon, 20 Jul 2009) Log Message: ----------- fix for error message displaying first time the wp-login page is loaded Modified Paths: -------------- trunk/ldap_auth.php Modified: trunk/ldap_auth.php =================================================================== --- trunk/ldap_auth.php 2009-07-17 03:07:56 UTC (rev 88) +++ trunk/ldap_auth.php 2009-07-20 14:46:18 UTC (rev 89) @@ -55,6 +55,9 @@ add_filter('show_adduser_fields', 'wpmuLdapDisableShowUser'); function wp_authenticate($username,$password) { + // Necessary to stop error message from display on first page load + if (empty($username)) return new WP_Error(); + $isSSO = ($username == '[LDAP_SSO]'); if ($isSSO) { /* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <axe...@us...> - 2009-07-17 03:07:59
|
Revision: 88 http://wpmu-ldap.svn.sourceforge.net/wpmu-ldap/?rev=88&view=rev Author: axelseaa Date: 2009-07-17 03:07:56 +0000 (Fri, 17 Jul 2009) Log Message: ----------- tagging new release Added Paths: ----------- tags/wpmu-ldap_2.8.1/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <axe...@us...> - 2009-07-17 03:06:47
|
Revision: 87 http://wpmu-ldap.svn.sourceforge.net/wpmu-ldap/?rev=87&view=rev Author: axelseaa Date: 2009-07-17 03:06:43 +0000 (Fri, 17 Jul 2009) Log Message: ----------- version bump Modified Paths: -------------- trunk/ldap/doc/README trunk/ldap_auth.php Modified: trunk/ldap/doc/README =================================================================== --- trunk/ldap/doc/README 2009-07-15 01:16:33 UTC (rev 86) +++ trunk/ldap/doc/README 2009-07-17 03:06:43 UTC (rev 87) @@ -5,8 +5,8 @@ License: ================================================================================ -LDAP-Authentication Plugin, v.2.7 -for WPMU 2.7.x +LDAP-Authentication Plugin, v.2.8.1 +for WPMU 2.8.x Copyright (C) 2009 Alistair Young, Patrick Cavit, Hugo Salgado, Alex Barker, and Sean Wedig, Aaron Axelsen Modified: trunk/ldap_auth.php =================================================================== --- trunk/ldap_auth.php 2009-07-15 01:16:33 UTC (rev 86) +++ trunk/ldap_auth.php 2009-07-17 03:06:43 UTC (rev 87) @@ -3,7 +3,7 @@ Plugin Name: LDAP Authentication Plug-in Plugin URI: http://wpmuldap.frozenpc.net Description: A plugin to override the core Wordpress MU authentication method so as to use an LDAP server for authentication. -Version: 2.7.1.1 +Version: 2.8.1 Author: Alistair Young (http://www.weblogs.uhi.ac.uk/sm00ay/), Patrick Cavit (http://patcavit.com), Hugo Salgado (http://hugo.vulcano.cl), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <axe...@us...> - 2009-07-15 01:16:43
|
Revision: 86 http://wpmu-ldap.svn.sourceforge.net/wpmu-ldap/?rev=86&view=rev Author: axelseaa Date: 2009-07-15 01:16:33 +0000 (Wed, 15 Jul 2009) Log Message: ----------- display_username fix - fixes #2821294 - thanks bforchhammer Modified Paths: -------------- trunk/ldap/lib/wpmu_ldap.functions.php trunk/ldap/lib/wpmu_ldap_admin.functions.php Modified: trunk/ldap/lib/wpmu_ldap.functions.php =================================================================== --- trunk/ldap/lib/wpmu_ldap.functions.php 2009-07-14 23:56:02 UTC (rev 85) +++ trunk/ldap/lib/wpmu_ldap.functions.php 2009-07-15 01:16:33 UTC (rev 86) @@ -32,15 +32,18 @@ //Set Public Display Name $displayName = get_site_option('ldapPublicDisplayName'); + $display_name = ''; $ldapnick = $ldapUserData[LDAP_INDEX_NICKNAME]; if (!empty($ldapnick)) - update_usermeta( $user_id, 'display_name', $ldapnick); + $display_name = $ldapnick; else if (!empty($displayName)) { - if ($displayName == 'username') update_usermeta( $user_id, 'display_name', $newUserName); - if ($displayName == 'first') update_usermeta( $user_id, 'display_name', $ldapUserData[LDAP_INDEX_GIVEN_NAME]); - if ($displayName == 'firstlast') update_usermeta( $user_id, 'display_name', $ldapUserData[LDAP_INDEX_GIVEN_NAME].' '.$ldapUserData[LDAP_INDEX_SURNAME]); - if ($displayName == 'lastfirst') update_usermeta( $user_id, 'display_name', $ldapUserData[LDAP_INDEX_SURNAME].' '.$ldapUserData[LDAP_INDEX_GIVEN_NAME]); - } else update_usermeta( $user_id, 'display_name', $newUserName); + if ($displayName == 'username') $display_name = $newUserName; + if ($displayName == 'first') $display_name = $ldapUserData[LDAP_INDEX_GIVEN_NAME]; + if ($displayName == 'firstlast') $display_name = $ldapUserData[LDAP_INDEX_GIVEN_NAME].' '.$ldapUserData[LDAP_INDEX_SURNAME]; + if ($displayName == 'lastfirst') $display_name = $ldapUserData[LDAP_INDEX_SURNAME].' '.$ldapUserData[LDAP_INDEX_GIVEN_NAME]; + } else $display_name = $newUserName; + + if (!empty($display_name)) $wpdb->update( $wpdb->users, compact( 'display_name' ), array( 'ID' => $user_id ) ); //This is for plugin events do_action('wpmu_activate_user', $user_id, $newUserPassword, false); Modified: trunk/ldap/lib/wpmu_ldap_admin.functions.php =================================================================== --- trunk/ldap/lib/wpmu_ldap_admin.functions.php 2009-07-14 23:56:02 UTC (rev 85) +++ trunk/ldap/lib/wpmu_ldap_admin.functions.php 2009-07-15 01:16:33 UTC (rev 86) @@ -75,7 +75,11 @@ wpmuLdapFixMeta(); update_site_option('ldapfixmetafor15','true'); echo "<div id='message' class='updated fade'><p>All users ldap_auth meta values updated!</p></div>"; - } + } else if ($_POST['ldapFixDisplayName']) { + wpmuLdapFixDisplayName(); + update_site_option('ldapfixdisplayname','true'); + echo "<div id='message' class='updated fade'><p>All users display_name meta values have been removed and set in the users table!</p></div>"; + } } @@ -138,6 +142,7 @@ $ret['ldapSignupMessage'] = stripslashes(get_site_option('ldapSignupMessage', $defaultSignupMessage)); $ret['ldapGetPasswordMessage'] = stripslashes(get_site_option('ldapGetPasswordMessage', $defaultGetPasswordMessage)); $ret['ldapfixmetafor15'] = get_site_option('ldapfixmetafor15'); + $ret['ldapfixdisplayname'] = get_site_option('ldapfixdisplayname'); $ret['ldapBulkAdd'] = get_site_option('ldapBulkAdd'); $ret['ldapPublicDisplayName'] = get_site_option('ldapPublicDisplayName'); $ret['ldapAttributeMail'] = get_site_option('ldapAttributeMail',LDAP_DEFAULT_ATTRIBUTE_MAIL); @@ -438,21 +443,28 @@ } function ldapOptionsPanelUpdates() { + extract(getWpmuLdapSiteOptions()); ?> <form method="post" id="ldap_fix_meta"> <h3>Upgrade</h3> <table class="form-table"> <tr valign="top"> + <th scope="row"><?php _e('Update Display Name'); ?></th> + <td> + Migrate all display name values from usermeta values into the users database table. + <p><?php if ($ldapfixdisplayname) echo "ALREADY PROCESSED"; ?> + <input type="submit" name="ldapFixDisplayName" value="Fix Display Name"/></p> + </td> + </tr> + <tr valign="top"> <th scope="row"><?php _e('Update Meta'); ?></th> <td> WARNING: Clicking on the button will update ALL blog users except admin to be set with the ldap_login meta value. If you have local users, this will also change them. This is only needed for those users upgrading from the 1.3 series of wordpress. + <p><?php if ($ldapfixmetafor15) echo "ALREADY PROCESSED"; ?> + <input type="submit" name="ldapFixMeta" value="Fix Meta (Required if upgrading from WPMU 1.3)"/></p> </td> </tr> </table> - <p class="submit"> - <?php echo $ldapfixmeta ?> - <input type="submit" name="ldapFixMeta" value="Fix Meta (Required if upgrading from WPMU 1.3)"/> - </p> </form> <?php } @@ -676,6 +688,25 @@ } /** + * Updates displayname for all user accounts that are ldap enabled. Older version of this plugin stored this in user_meta values, when + * it should be correctly stored in the users table. + */ +function wpmuLdapFixDisplayName() { + global $wpdb; + $users = $wpdb->get_results("SELECT ID from $wpdb->users WHERE ID > 1"); + foreach ($users as $user) { + $ldap = get_usermeta( $user->ID, 'ldap_login'); + if ($ldap) { + $display_name = get_usermeta( $user->ID, 'display_name' ); + if (!empty($display_name)) { + $wpdb->update( $wpdb->users, compact( 'display_name' ), array( 'ID' => $user->ID ) ); + delete_usermeta( $user->ID, 'display_name', $display_name); + } + } + } +} + +/** * Displays the account authentication type options on the edit user form. */ function wpmuUserFormLdapOption() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <axe...@us...> - 2009-07-14 23:56:06
|
Revision: 85 http://wpmu-ldap.svn.sourceforge.net/wpmu-ldap/?rev=85&view=rev Author: axelseaa Date: 2009-07-14 23:56:02 +0000 (Tue, 14 Jul 2009) Log Message: ----------- removed default add new menu in 2.7, revamped logic adding subscribers to blog, minor code cleanup Modified Paths: -------------- trunk/ldap/lib/wpmu_ldap.functions.php trunk/ldap_auth.php Modified: trunk/ldap/lib/wpmu_ldap.functions.php =================================================================== --- trunk/ldap/lib/wpmu_ldap.functions.php 2009-07-09 03:25:14 UTC (rev 84) +++ trunk/ldap/lib/wpmu_ldap.functions.php 2009-07-14 23:56:02 UTC (rev 85) @@ -149,24 +149,19 @@ return new WP_Error('update_usermeta', __('<strong>ERROR</strong>: Error updating user meta information.')); } } - + // Handle blog removal for various reasons - if( is_site_admin( $username ) == false && ( $primary_blog = get_usermeta( $loginObj->ID, "primary_blog" ) ) ) { - $details = get_blog_details( $primary_blog ); - if( is_object( $details ) ) { - if( $details->archived == 1 || $details->spam == 1 || $details->deleted == 1 ) { - if ( get_site_option( 'dashboard_blog' ) == false ) - add_user_to_blog( '1', $loginObj->ID, get_site_option( 'default_user_role', 'subscriber' ) ); - else - add_user_to_blog( get_site_option( 'dashboard_blog' ), $loginObj->ID, get_site_option( 'default_user_role', 'subscriber' ) ); + if(is_site_admin($username) === false) { + if ($primary_blog = get_usermeta($loginObj->ID, "primary_blog")) { + $details = get_blog_details( $primary_blog ); + if( is_object( $details ) && $details->archived == 1 || $details->spam == 1 || $details->deleted == 1 ) { + // reset primary blog to #1 (or dashboard) and add subscriber role + wpmuUpdateBlogAccess($loginObj->ID); } + } else { + // make sure user is subscribed to blog #1 or dashboard blog + wpmuUpdateBlogAccess($loginObj->ID); } - } else { - // If user does not have a primary blog, add them to default blog - if ( get_site_option( 'dashboard_blog' ) == false ) - add_user_to_blog( '1', $loginObj->ID, get_site_option( 'default_user_role', 'subscriber' ) ); - else - add_user_to_blog( get_site_option( 'dashboard_blog' ), $loginObj->ID, get_site_option( 'default_user_role', 'subscriber' ) ); } // if we get to here - they're authenticated, they have a WP account, so it's all set @@ -275,3 +270,34 @@ $server->Disconnect(); return $result; } + +function ldapSSOAuthenticate($username, $password) { + if ( empty($_GET['loggedout']) // we have not just logged out + && !wp_validate_auth_cookie() // we do not have a cookie + && empty($username) ) { // and we're not already trying to log in with a different username + $username = "[LDAP_SSO]"; + $password = "[LDAP_SSO]"; + } +} + +/** +* +*/ +function wpmuUpdateBlogAccess($userid) { + // reset primary blog to #1 (or dashboard) and add subscriber role + if ($dashboard = get_site_option( 'dashboard_blog' )) { + add_user_to_blog( $dashboard, $userid, get_site_option( 'default_user_role', 'subscriber' ) ); + update_usermeta($userid, "primary_blog", $dashboard); + } else { + add_user_to_blog( '1', $userid, get_site_option( 'default_user_role', 'subscriber' ) ); + update_usermeta($userid, "primary_blog", 1); + } +} +/** +* Remove the Add New menu item added in 2.7 +*/ +function wpmuRemoveAddNewMenu() { + global $submenu; + unset($submenu['users.php'][10]); +} + Modified: trunk/ldap_auth.php =================================================================== --- trunk/ldap_auth.php 2009-07-09 03:25:14 UTC (rev 84) +++ trunk/ldap_auth.php 2009-07-14 23:56:02 UTC (rev 85) @@ -17,42 +17,33 @@ require_once("ldap/lib/ldap_ro.php"); // methods for supporting site-admin configuration of the plugin -// TODO: Limit this code to only be called when in the admin interface, instead of with every WPMU call require_once("ldap/lib/wpmu_ldap_admin.functions.php"); require_once("ldap/lib/wpmu_ldap_adduser.functions.php"); + add_action('admin_head', 'ldapShowOptionsCss'); add_action('admin_menu', 'ldap_addmenu'); add_action('admin_menu', 'ldap_addmenuuser'); +add_action('admin_menu', 'wpmuRemoveAddNewMenu'); -// Add radio buttons for switching individual users between LDAP accounts and non-LDAP accounts -add_action('edit_user_profile', 'wpmuUserFormLdapOption'); -add_action('edit_user_profile_update', 'wpmuUserFormLdapOptionUpdate'); +// perform these filters, actions, and WP function overrides only if LDAP- +// authentication is enabled; this is to cut down on parsing of this code when +// it doesn't apply +if (get_site_option("ldapAuth")) { -// *** End Admin Config Functions *** // + // Add radio buttons for switching individual users between LDAP accounts and non-LDAP accounts + add_action('edit_user_profile', 'wpmuUserFormLdapOption'); + add_action('edit_user_profile_update', 'wpmuUserFormLdapOptionUpdate'); -// *** Begin User Auth Functions *** // -// disable public signup if configured to do so -if (get_site_option('ldapDisableSignup')) { - add_action('signup_header', 'wpmuLdapDisableSignup'); - add_action('login_head', 'wpmuLdapDisableSignupMessage'); -} + // *** End Admin Config Functions *** // -function ldapSSOAuthenticate($username, $password) { - if ( empty($_GET['loggedout']) // we have not just logged out - && !wp_validate_auth_cookie() // we do not have a cookie - && empty($username) ) { // and we're not already trying to log in with a different username - $username = "[LDAP_SSO]"; - $password = "[LDAP_SSO]"; + // *** Begin User Auth Functions *** // + // disable public signup if configured to do so + if (get_site_option('ldapDisableSignup')) { + add_action('signup_header', 'wpmuLdapDisableSignup'); + add_action('login_head', 'wpmuLdapDisableSignupMessage'); } -} -if (get_site_option('ldapSSOEnabled')) { - add_action('wp_authenticate', 'ldapSSOAuthenticate', 10, 2); -} -// perform these filters, actions, and WP function overrides only if LDAP- -// authentication is enabled; this is to cut down on parsing of this code when -// it doesn't apply -if (get_site_option("ldapAuth")) { + if (get_site_option('ldapSSOEnabled')) add_action('wp_authenticate', 'ldapSSOAuthenticate', 10, 2); // only include them if it's active, so as to cut down on continual parsing of the code require_once("ldap/lib/wpmu_ldap.functions.php"); @@ -122,16 +113,6 @@ if ($user != false) { $ldap_login = get_usermeta($user->ID,'ldap_login'); - if( is_site_admin( $username ) == false && ( $primary_blog = get_usermeta( $user->ID, "primary_blog" ) ) ) { - $details = get_blog_details( $primary_blog ); - if( is_object( $details ) && $details->archived == 1 || $details->spam == 1 || $details->deleted == 1 ) { - if ( get_site_option( 'dashboard_blog' ) == false ) - add_user_to_blog( '1', $user->ID, get_site_option( 'default_user_role', 'subscriber' ) ); - else - add_user_to_blog( get_site_option( 'dashboard_blog' ), $user->ID, get_site_option( 'default_user_role', 'subscriber' ) ); - } - } - //Setup redirection to users home directory. if (!strpos($_REQUEST['redirect_to'], $username)) { $_REQUEST['redirect_to'] = $username . "/" . $_REQUEST['redirect_to']; @@ -148,6 +129,7 @@ do_action( 'wp_login_failed', $username ); return new WP_Error('incorrect_password', __('<strong>ERROR</strong>: Incorrect password.')); } + wpmuUpdateBlogAccess($user->ID); return new WP_User($user->ID); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <axe...@us...> - 2009-07-09 03:25:16
|
Revision: 84 http://wpmu-ldap.svn.sourceforge.net/wpmu-ldap/?rev=84&view=rev Author: axelseaa Date: 2009-07-09 03:25:14 +0000 (Thu, 09 Jul 2009) Log Message: ----------- change to ldap_connect call - now connects using correct options according to php docs Modified Paths: -------------- trunk/ldap/lib/ldap_core.php Modified: trunk/ldap/lib/ldap_core.php =================================================================== --- trunk/ldap/lib/ldap_core.php 2009-06-13 22:57:10 UTC (rev 83) +++ trunk/ldap/lib/ldap_core.php 2009-07-09 03:25:14 UTC (rev 84) @@ -43,9 +43,11 @@ $proto = "ldap://"; if ($this->debug) { - $this->connection_handle = ldap_connect ($proto.$this->server, $this->port); + #$this->connection_handle = ldap_connect ($proto.$this->server, $this->port); + $this->connection_handle = ldap_connect ($proto.$this->server.':'.$this->port); } else { - $this->connection_handle = @ldap_connect ($proto.$this->server, $this->port); + #$this->connection_handle = @ldap_connect ($proto.$this->server, $this->port); + $this->connection_handle = @ldap_connect ($proto.$this->server.':'.$this->port); } // Error connecting? This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <axe...@us...> - 2009-06-13 22:57:12
|
Revision: 83 http://wpmu-ldap.svn.sourceforge.net/wpmu-ldap/?rev=83&view=rev Author: axelseaa Date: 2009-06-13 22:57:10 +0000 (Sat, 13 Jun 2009) Log Message: ----------- added sso functionality - thanks bforchhammer Modified Paths: -------------- trunk/ldap/lib/wpmu_ldap_admin.functions.php trunk/ldap_auth.php Modified: trunk/ldap/lib/wpmu_ldap_admin.functions.php =================================================================== --- trunk/ldap/lib/wpmu_ldap_admin.functions.php 2009-06-11 12:12:13 UTC (rev 82) +++ trunk/ldap/lib/wpmu_ldap_admin.functions.php 2009-06-13 22:57:10 UTC (rev 83) @@ -117,6 +117,7 @@ $ret = array(); $ret['ldapAuth'] = get_site_option('ldapAuth'); + $ret['ldapSSOEnabled'] = get_site_option('ldapSSOEnabled'); $ret['ldapCreateAcct'] = get_site_option('ldapCreateAcct'); $ret['ldapCreateBlog'] = get_site_option('ldapCreateBlog'); $ret['ldapLinuxWindows'] = get_site_option('ldapLinuxWindows'); @@ -162,6 +163,9 @@ $tDisableSignup = ''; $fDisableSignup = ''; $tCreateLocalUser = ''; $fCreateLocalUser = ''; + if ($ldapSSOEnabled) $tSSOChecked = "checked='checked'"; + else $fSSOChecked = "checked='checked'"; + if($ldapCreateAcct) $tAcctChecked = "checked='checked'"; else $fAcctChecked = "checked='checked'"; @@ -192,6 +196,17 @@ <h3>General Settings</h3> <table class="form-table"> <tr valign="top"> + <th scope="row">Use Single Sign-On?</th> + <td> + <input type='radio' name='ldapSSOEnabled' id='ldapSSOEnabledYes' value='1' <?php echo $tSSOChecked ?>/> <label for="ldapSSOEnabledYes">Yes</label> + <input type='radio' name='ldapSSOEnabled' id='ldapSSOEnabledNo' value='0' <?php echo $fSSOChecked ?>/> <label for="ldapSSOEnabledNo">No</label> + <br/> + If "Yes", the system will try to automatically log users into their accounts + using NTLM Authentication. In order for this to work "Windows Authentication" + needs to be activated on the file "wp-login.php". + </td> + </tr> + <tr valign="top"> <th scope="row">Auto-Create WPMU Accounts?</th> <td> <input type='radio' name='ldapCreateAcct' id='createAcctYes' value='1' <?php echo $tAcctChecked ?>/> <label for="createAcctYes">Yes</label> Modified: trunk/ldap_auth.php =================================================================== --- trunk/ldap_auth.php 2009-06-11 12:12:13 UTC (rev 82) +++ trunk/ldap_auth.php 2009-06-13 22:57:10 UTC (rev 83) @@ -37,6 +37,18 @@ add_action('login_head', 'wpmuLdapDisableSignupMessage'); } +function ldapSSOAuthenticate($username, $password) { + if ( empty($_GET['loggedout']) // we have not just logged out + && !wp_validate_auth_cookie() // we do not have a cookie + && empty($username) ) { // and we're not already trying to log in with a different username + $username = "[LDAP_SSO]"; + $password = "[LDAP_SSO]"; + } +} +if (get_site_option('ldapSSOEnabled')) { + add_action('wp_authenticate', 'ldapSSOAuthenticate', 10, 2); +} + // perform these filters, actions, and WP function overrides only if LDAP- // authentication is enabled; this is to cut down on parsing of this code when // it doesn't apply @@ -52,62 +64,112 @@ add_filter('show_adduser_fields', 'wpmuLdapDisableShowUser'); function wp_authenticate($username,$password) { - // make sure we always use lowercase usernames - $username = strtolower($username); + $isSSO = ($username == '[LDAP_SSO]'); + if ($isSSO) { + /* + AUTH_USER: The name of the user as it is derived from the authorization + header sent by the client, before the user name is mapped to a Windows + account. This variable is no different from REMOTE_USER. If you have an + authentication filter installed on your Web server that maps incoming users + to accounts, use LOGON_USER to view the mapped user name. + + LOGON_USER: The Windows account that the user is impersonating while + connected to your Web server. Use REMOTE_USER or AUTH_USER to view the raw + user name that is contained in the request header. The only time LOGON_USER + holds a different value than these other variables is if you have an + authentication filter installed. + + REMOTE_USER: The name of the user as it is derived from the authorization + header sent by the client, before the user name is mapped to a Windows + account. If you have an authentication filter installed on your Web server + that maps incoming users to accounts, use LOGON_USER to view the mapped user + name. + */ + $sso_user = ''; + if (!empty($_SERVER['LOGON_USER'])) + $sso_user = $_SERVER['LOGON_USER']; + elseif (!empty($_SERVER['REMOTE_USER'])) + $sso_user = $_SERVER['REMOTE_USER']; + elseif(!empty($_SERVER['AUTH_USER'])) + $sso_user = $_SERVER['AUTH_USER']; + + // strip user account domain + if (strpos($sso_user, '\\\\') !== FALSE) { + $sso_user = substr($sso_user, strpos($sso_user, '\\\\') + 2); + } + if (!empty($sso_user)) { + $username = $sso_user; + $password = wp_generate_password(); //create a random password for the local user + } else { + $isSSO = false; + } + } + + // make sure we always use lowercase usernames + $username = strtolower($username); $username = sanitize_user($username); - // Is Ldap enabled? - $ldapAuth = get_site_option("ldapAuth"); + // Is Ldap enabled? + $ldapAuth = get_site_option("ldapAuth"); - // setup ldap string - $ldapString = wpmuSetupLdapOptions(); + // setup ldap string + $ldapString = wpmuSetupLdapOptions(); // try finding a WP account for this user name $user = get_userdatabylogin($username); // if username exists, lets check and see if they are already logged in if ($user != false) { - $ldap_login = get_usermeta($user->ID,'ldap_login'); - if( is_site_admin( $username ) == false && ( $primary_blog = get_usermeta( $user->ID, "primary_blog" ) ) ) { - $details = get_blog_details( $primary_blog ); - if( is_object( $details ) && $details->archived == 1 || $details->spam == 1 || $details->deleted == 1 ) { - if ( get_site_option( 'dashboard_blog' ) == false ) - add_user_to_blog( '1', $user->ID, get_site_option( 'default_user_role', 'subscriber' ) ); - else - add_user_to_blog( get_site_option( 'dashboard_blog' ), $user->ID, get_site_option( 'default_user_role', 'subscriber' ) ); - } - } + if( is_site_admin( $username ) == false && ( $primary_blog = get_usermeta( $user->ID, "primary_blog" ) ) ) { + $details = get_blog_details( $primary_blog ); + if( is_object( $details ) && $details->archived == 1 || $details->spam == 1 || $details->deleted == 1 ) { + if ( get_site_option( 'dashboard_blog' ) == false ) + add_user_to_blog( '1', $user->ID, get_site_option( 'default_user_role', 'subscriber' ) ); + else + add_user_to_blog( get_site_option( 'dashboard_blog' ), $user->ID, get_site_option( 'default_user_role', 'subscriber' ) ); + } + } - //Setup redirection to users home directory. - if (!strpos($_REQUEST['redirect_to'], $username)) { - $_REQUEST['redirect_to'] = $username . "/" . $_REQUEST['redirect_to']; - } + //Setup redirection to users home directory. + if (!strpos($_REQUEST['redirect_to'], $username)) { + $_REQUEST['redirect_to'] = $username . "/" . $_REQUEST['redirect_to']; + } // Try for local login if ($ldap_login != true || $ldap_login != 'true') { - if ( !$user || ($user->user_login != $username) ) { - do_action( 'wp_login_failed', $username ); - return new WP_Error('invalid_username', __('<strong>ERROR</strong>: Invalid username.')); - } + if ( !$user || ($user->user_login != $username) ) { + do_action( 'wp_login_failed', $username ); + return new WP_Error('invalid_username', __('<strong>ERROR</strong>: Invalid username.')); + } - if ( !wp_check_password($password, $user->user_pass, $user->ID) ) { - do_action( 'wp_login_failed', $username ); - return new WP_Error('incorrect_password', __('<strong>ERROR</strong>: Incorrect password.')); - } + if ( !wp_check_password($password, $user->user_pass, $user->ID) ) { + do_action( 'wp_login_failed', $username ); + return new WP_Error('incorrect_password', __('<strong>ERROR</strong>: Incorrect password.')); + } - return new WP_User($user->ID); + return new WP_User($user->ID); } } - // Authenticate via LDAP, potentially creating a WP user - $ldapauthresult = wpmuLdapAuthenticate($ldapString, $username, $password); + if ($isSSO) { + // search for user and retrieve user data + $ldapString = wpmuSetupLdapOptions(); + $userDataArray = null; + $result = wpmuLdapSearch($ldapString,$username,$userDataArray); + $ldapauthresult = array('result' => $result, 'userdata' => $userDataArray); + } else { + // Authenticate via LDAP, potentially creating a WP user + $ldapauthresult = wpmuLdapAuthenticate($ldapString, $username, $password); + } if ($ldapauthresult['result']) { return wpmuLdapProcess($user, $username, $password, $ldapauthresult['userdata']); + } elseif ($isSSO) { + return new WP_Error('sso_failed', sprintf(__('Single Sign-On as user <em>%s</em> failed. Please login using the form below.'),$username)); } else { - return $ldapauthresult['errors']; + return $ldapauthresult['errors']; } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <axe...@us...> - 2009-06-11 13:14:39
|
Revision: 82 http://wpmu-ldap.svn.sourceforge.net/wpmu-ldap/?rev=82&view=rev Author: axelseaa Date: 2009-06-11 12:12:13 +0000 (Thu, 11 Jun 2009) Log Message: ----------- automatically converts attribute names to lowercase on save Modified Paths: -------------- trunk/ldap/lib/wpmu_ldap_admin.functions.php Modified: trunk/ldap/lib/wpmu_ldap_admin.functions.php =================================================================== --- trunk/ldap/lib/wpmu_ldap_admin.functions.php 2009-05-03 07:02:22 UTC (rev 81) +++ trunk/ldap/lib/wpmu_ldap_admin.functions.php 2009-06-11 12:12:13 UTC (rev 82) @@ -57,8 +57,10 @@ function wpmuProcessUpdates() { if($_POST['ldapOptionsSave']) { - foreach ($_POST as $key => $item) + foreach ($_POST as $key => $item) { + if (stripos($key,'attribute')) $item = strtolower($item); if ($key != 'ldapOptionsSave' || $key != 'ldapTestConnection') update_site_option($key,stripslashes($item)); + } # Test Ldap Connection if ($_POST['ldapTestConnection']) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <axe...@us...> - 2009-05-03 07:02:29
|
Revision: 81 http://wpmu-ldap.svn.sourceforge.net/wpmu-ldap/?rev=81&view=rev Author: axelseaa Date: 2009-05-03 07:02:22 +0000 (Sun, 03 May 2009) Log Message: ----------- possible fix for issue with role getting set to subscriber - also updated to use the dashboard_blog and default role Modified Paths: -------------- trunk/ldap/lib/wpmu_ldap.functions.php trunk/ldap_auth.php Modified: trunk/ldap/lib/wpmu_ldap.functions.php =================================================================== --- trunk/ldap/lib/wpmu_ldap.functions.php 2009-05-02 14:23:53 UTC (rev 80) +++ trunk/ldap/lib/wpmu_ldap.functions.php 2009-05-03 07:02:22 UTC (rev 81) @@ -155,16 +155,21 @@ $details = get_blog_details( $primary_blog ); if( is_object( $details ) ) { if( $details->archived == 1 || $details->spam == 1 || $details->deleted == 1 ) { - add_user_to_blog('1',$loginObj->ID,'subscriber'); - #return new WP_Error('blog_suspended', __('<strong>ERROR</strong>: Blog suspended.')); + if ( get_site_option( 'dashboard_blog' ) == false ) + add_user_to_blog( '1', $loginObj->ID, get_site_option( 'default_user_role', 'subscriber' ) ); + else + add_user_to_blog( get_site_option( 'dashboard_blog' ), $loginObj->ID, get_site_option( 'default_user_role', 'subscriber' ) ); } } } else { - // If user does not have a primary blog, set them as a subscriber to blog 1 - add_user_to_blog('1',$loginObj->ID,'subscriber'); + // If user does not have a primary blog, add them to default blog + if ( get_site_option( 'dashboard_blog' ) == false ) + add_user_to_blog( '1', $loginObj->ID, get_site_option( 'default_user_role', 'subscriber' ) ); + else + add_user_to_blog( get_site_option( 'dashboard_blog' ), $loginObj->ID, get_site_option( 'default_user_role', 'subscriber' ) ); } - // if we get to here - they're authenticated, they have a WP account, so - // it's all set + + // if we get to here - they're authenticated, they have a WP account, so it's all set return new WP_User($loginObj->ID); } Modified: trunk/ldap_auth.php =================================================================== --- trunk/ldap_auth.php 2009-05-02 14:23:53 UTC (rev 80) +++ trunk/ldap_auth.php 2009-05-03 07:02:22 UTC (rev 81) @@ -3,7 +3,7 @@ Plugin Name: LDAP Authentication Plug-in Plugin URI: http://wpmuldap.frozenpc.net Description: A plugin to override the core Wordpress MU authentication method so as to use an LDAP server for authentication. -Version: 2.7.1 +Version: 2.7.1.1 Author: Alistair Young (http://www.weblogs.uhi.ac.uk/sm00ay/), Patrick Cavit (http://patcavit.com), Hugo Salgado (http://hugo.vulcano.cl), @@ -73,14 +73,13 @@ if( is_site_admin( $username ) == false && ( $primary_blog = get_usermeta( $user->ID, "primary_blog" ) ) ) { $details = get_blog_details( $primary_blog ); if( is_object( $details ) && $details->archived == 1 || $details->spam == 1 || $details->deleted == 1 ) { - add_user_to_blog('1',$user->ID,'subscriber'); - #return new WP_Error('blog_suspended', __('<strong>ERROR</strong>: Blog suspended.')); + if ( get_site_option( 'dashboard_blog' ) == false ) + add_user_to_blog( '1', $user->ID, get_site_option( 'default_user_role', 'subscriber' ) ); + else + add_user_to_blog( get_site_option( 'dashboard_blog' ), $user->ID, get_site_option( 'default_user_role', 'subscriber' ) ); } - } else { - // If user does not have a primary blog, set them as a subscriber to blog 1 - add_user_to_blog('1',$user->ID,'subscriber'); - } - + } + //Setup redirection to users home directory. if (!strpos($_REQUEST['redirect_to'], $username)) { $_REQUEST['redirect_to'] = $username . "/" . $_REQUEST['redirect_to']; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <axe...@us...> - 2009-05-02 14:24:00
|
Revision: 80 http://wpmu-ldap.svn.sourceforge.net/wpmu-ldap/?rev=80&view=rev Author: axelseaa Date: 2009-05-02 14:23:53 +0000 (Sat, 02 May 2009) Log Message: ----------- updated explanation to include nickname mapping precedence Modified Paths: -------------- trunk/ldap/lib/wpmu_ldap_admin.functions.php Modified: trunk/ldap/lib/wpmu_ldap_admin.functions.php =================================================================== --- trunk/ldap/lib/wpmu_ldap_admin.functions.php 2009-05-02 14:15:12 UTC (rev 79) +++ trunk/ldap/lib/wpmu_ldap_admin.functions.php 2009-05-02 14:23:53 UTC (rev 80) @@ -270,7 +270,7 @@ <option value='lastfirst' <?php echo $displayNameSelect == 'lastfirst' ? ' selected="selected"' : ''; ?>>lastname firstname</option> </select> <br/> - Sets the default display name format to use for new account creations. + Sets the default display name format to use for new account creations. If LDAP Nickname attribute mapping is set, that will take precedence over this format. </td> </tr> <tr valign="top"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <axe...@us...> - 2009-05-02 14:15:24
|
Revision: 79 http://wpmu-ldap.svn.sourceforge.net/wpmu-ldap/?rev=79&view=rev Author: axelseaa Date: 2009-05-02 14:15:12 +0000 (Sat, 02 May 2009) Log Message: ----------- ability to map wordpress nickname value to ldap attribute Modified Paths: -------------- trunk/ldap/lib/defines.php trunk/ldap/lib/ldap_core.php trunk/ldap/lib/ldap_ro.php trunk/ldap/lib/wpmu_ldap.functions.php trunk/ldap/lib/wpmu_ldap_admin.functions.php Modified: trunk/ldap/lib/defines.php =================================================================== --- trunk/ldap/lib/defines.php 2009-04-20 02:51:57 UTC (rev 78) +++ trunk/ldap/lib/defines.php 2009-05-02 14:15:12 UTC (rev 79) @@ -23,8 +23,10 @@ define ('LDAP_INDEX_DN', '12'); define ('LDAP_INDEX_LOCATION', '13'); define ('LDAP_INDEX_ROLE', '14'); +define ('LDAP_INDEX_NICKNAME', '15'); define ('LDAP_DEFAULT_ATTRIBUTE_MAIL', 'mail'); +define ('LDAP_DEFAULT_ATTRIBUTE_NICKNAME', ''); define ('LDAP_DEFAULT_ATTRIBUTE_GIVENNAME', 'givenname'); define ('LDAP_DEFAULT_ATTRIBUTE_SN', 'sn'); define ('LDAP_DEFAULT_ATTRIBUTE_PHONE', 'phone'); Modified: trunk/ldap/lib/ldap_core.php =================================================================== --- trunk/ldap/lib/ldap_core.php 2009-04-20 02:51:57 UTC (rev 78) +++ trunk/ldap/lib/ldap_core.php 2009-05-02 14:15:12 UTC (rev 79) @@ -172,6 +172,7 @@ function GetLDAPInfo ($type) { $mail = get_site_option('ldapAttributeMail',LDAP_DEFAULT_ATTRIBUTE_MAIL); + $nickname = get_site_option('ldapAttributeNickname',LDAP_DEFAULT_ATTRIBUTE_NICKNAME); $givenname = get_site_option('ldapAttributeGivenname',LDAP_DEFAULT_ATTRIBUTE_GIVENNAME); $sn = get_site_option('ldapAttributeSn',LDAP_DEFAULT_ATTRIBUTE_SN); $phone = get_site_option('ldapAttributePhone',LDAP_DEFAULT_ATTRIBUTE_PHONE); @@ -191,6 +192,7 @@ // When dealing with "uniqueMember", LDAP actually returns it as "member" - they're synonyms if ($type == LDAP_INDEX_UNIQUE_MEMBER) return $this->info[0][$member]; if ($type == LDAP_INDEX_DN) return $this->info[0][$dn]; + if ($type == LDAP_INDEX_NICKNAME) return empty($nickname) ? false : $this->info[0][$nickname][0]; } } ?> Modified: trunk/ldap/lib/ldap_ro.php =================================================================== --- trunk/ldap/lib/ldap_ro.php 2009-04-20 02:51:57 UTC (rev 78) +++ trunk/ldap/lib/ldap_ro.php 2009-05-02 14:15:12 UTC (rev 79) @@ -54,6 +54,7 @@ // Return the user's data $user_data[LDAP_INDEX_DN] = $this->info[0]["dn"]; $user_data[LDAP_INDEX_NAME] = $this->GetLDAPInfo (LDAP_INDEX_NAME); + $user_data[LDAP_INDEX_NICKNAME] = $this->GetLDAPInfo (LDAP_INDEX_NICKNAME); $user_data[LDAP_INDEX_EMAIL] = $this->GetLDAPInfo (LDAP_INDEX_EMAIL); $user_data[LDAP_INDEX_GIVEN_NAME] = $this->GetLDAPInfo (LDAP_INDEX_GIVEN_NAME); $user_data[LDAP_INDEX_SURNAME] = $this->GetLDAPInfo (LDAP_INDEX_SURNAME); @@ -94,6 +95,7 @@ $user_data[LDAP_INDEX_EMAIL] = $this->GetLDAPInfo (LDAP_INDEX_EMAIL); $user_data[LDAP_INDEX_NAME] = $this->GetLDAPInfo (LDAP_INDEX_NAME); + $user_data[LDAP_INDEX_NICKNAME] = $this->GetLDAPInfo (LDAP_INDEX_NICKNAME); $user_data[LDAP_INDEX_GIVEN_NAME] = $this->GetLDAPInfo (LDAP_INDEX_GIVEN_NAME); $user_data[LDAP_INDEX_SURNAME] = $this->GetLDAPInfo (LDAP_INDEX_SURNAME); $user_data[LDAP_INDEX_PHONE] = $this->GetLDAPInfo (LDAP_INDEX_PHONE); @@ -131,6 +133,7 @@ if ($this->info['count'] > 0) { $data[LDAP_INDEX_DN] = $this->info[0]["dn"]; $data[LDAP_INDEX_NAME] = $this->GetLDAPInfo (LDAP_INDEX_NAME); + $data[LDAP_INDEX_NICKNAME] = $this->GetLDAPInfo (LDAP_INDEX_NICKNAME); $data[LDAP_INDEX_EMAIL] = $this->GetLDAPInfo (LDAP_INDEX_EMAIL); $data[LDAP_INDEX_GIVEN_NAME] = $this->GetLDAPInfo (LDAP_INDEX_GIVEN_NAME); $data[LDAP_INDEX_SURNAME] = $this->GetLDAPInfo (LDAP_INDEX_SURNAME); Modified: trunk/ldap/lib/wpmu_ldap.functions.php =================================================================== --- trunk/ldap/lib/wpmu_ldap.functions.php 2009-04-20 02:51:57 UTC (rev 78) +++ trunk/ldap/lib/wpmu_ldap.functions.php 2009-05-02 14:15:12 UTC (rev 79) @@ -1,5 +1,4 @@ <?php - /** * Creates a WordPress user account from an LDAP response specified by * $ldapUserData. Assumes that a user account $newUserName does not already @@ -31,8 +30,12 @@ update_usermeta( $user_id, 'last_name', $ldapUserData[LDAP_INDEX_SURNAME] ); update_usermeta( $user_id, 'ldap_login', 'true' ); + //Set Public Display Name $displayName = get_site_option('ldapPublicDisplayName'); - if (!empty($displayName)) { + $ldapnick = $ldapUserData[LDAP_INDEX_NICKNAME]; + if (!empty($ldapnick)) + update_usermeta( $user_id, 'display_name', $ldapnick); + else if (!empty($displayName)) { if ($displayName == 'username') update_usermeta( $user_id, 'display_name', $newUserName); if ($displayName == 'first') update_usermeta( $user_id, 'display_name', $ldapUserData[LDAP_INDEX_GIVEN_NAME]); if ($displayName == 'firstlast') update_usermeta( $user_id, 'display_name', $ldapUserData[LDAP_INDEX_GIVEN_NAME].' '.$ldapUserData[LDAP_INDEX_SURNAME]); @@ -249,7 +252,7 @@ */ function wpmuLdapDisableSignup() { wp_redirect(get_option('siteurl').'/wp-login.php?action=signupdisabled'); - + $msg = stripslashes(get_site_option('ldapSignupMessage')); } Modified: trunk/ldap/lib/wpmu_ldap_admin.functions.php =================================================================== --- trunk/ldap/lib/wpmu_ldap_admin.functions.php 2009-04-20 02:51:57 UTC (rev 78) +++ trunk/ldap/lib/wpmu_ldap_admin.functions.php 2009-05-02 14:15:12 UTC (rev 79) @@ -139,6 +139,7 @@ $ret['ldapPublicDisplayName'] = get_site_option('ldapPublicDisplayName'); $ret['ldapAttributeMail'] = get_site_option('ldapAttributeMail',LDAP_DEFAULT_ATTRIBUTE_MAIL); $ret['ldapAttributeGivenname'] = get_site_option('ldapAttributeGivenname',LDAP_DEFAULT_ATTRIBUTE_GIVENNAME); + $ret['ldapAttributeNickname'] = get_site_option('ldapAttributeNickname',LDAP_DEFAULT_ATTRIBUTE_NICKNAME); $ret['ldapAttributeSn'] = get_site_option('ldapAttributeSn',LDAP_DEFAULT_ATTRIBUTE_SN); $ret['ldapAttributePhone'] = get_site_option('ldapAttributePhone',LDAP_DEFAULT_ATTRIBUTE_PHONE); $ret['ldapAttributeHomedir'] = get_site_option('ldapAttributeHomedir',LDAP_DEFAULT_ATTRIBUTE_HOMEDIR); @@ -468,6 +469,13 @@ </td> </tr> <tr valign="top"> + <th scope="row"><label for="ldapAttributeNickname">Nickname:</label></th> + <td> + <input type="text" name="ldapAttributeNickname" id="ldapAttributeNickname" value="<?php echo $ldapAttributeNickname ?>" /> + <br/> + </td> + </tr> + <tr valign="top"> <th scope="row"><label for="ldapAttributePhone">Phone:</label></th> <td> <input type="text" name="ldapAttributePhone" id="ldapAttributePhone" value="<?php echo $ldapAttributePhone ?>" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <axe...@us...> - 2009-04-20 02:52:04
|
Revision: 78 http://wpmu-ldap.svn.sourceforge.net/wpmu-ldap/?rev=78&view=rev Author: axelseaa Date: 2009-04-20 02:51:57 +0000 (Mon, 20 Apr 2009) Log Message: ----------- locking in new release Added Paths: ----------- tags/wpmu-ldap_2.7.1/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <axe...@us...> - 2009-04-20 02:44:51
|
Revision: 77 http://wpmu-ldap.svn.sourceforge.net/wpmu-ldap/?rev=77&view=rev Author: axelseaa Date: 2009-04-20 02:44:42 +0000 (Mon, 20 Apr 2009) Log Message: ----------- 2.7.1 version changed Modified Paths: -------------- trunk/ldap_auth.php Modified: trunk/ldap_auth.php =================================================================== --- trunk/ldap_auth.php 2009-04-09 00:08:14 UTC (rev 76) +++ trunk/ldap_auth.php 2009-04-20 02:44:42 UTC (rev 77) @@ -3,7 +3,7 @@ Plugin Name: LDAP Authentication Plug-in Plugin URI: http://wpmuldap.frozenpc.net Description: A plugin to override the core Wordpress MU authentication method so as to use an LDAP server for authentication. -Version: 2.7 +Version: 2.7.1 Author: Alistair Young (http://www.weblogs.uhi.ac.uk/sm00ay/), Patrick Cavit (http://patcavit.com), Hugo Salgado (http://hugo.vulcano.cl), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <axe...@us...> - 2009-04-09 00:08:23
|
Revision: 76 http://wpmu-ldap.svn.sourceforge.net/wpmu-ldap/?rev=76&view=rev Author: axelseaa Date: 2009-04-09 00:08:14 +0000 (Thu, 09 Apr 2009) Log Message: ----------- missed the search attribute - reworked logic Modified Paths: -------------- trunk/ldap/lib/ldap_ro.php Modified: trunk/ldap/lib/ldap_ro.php =================================================================== --- trunk/ldap/lib/ldap_ro.php 2009-04-07 04:19:17 UTC (rev 75) +++ trunk/ldap/lib/ldap_ro.php 2009-04-09 00:08:14 UTC (rev 76) @@ -30,16 +30,12 @@ // Set up the search stuff $attributes_to_get = array ("fullName", "mail", "givenName", "sn", "phone"); - if (get_site_option('ldapLinuxWindows')) { - //Linux - $uid = get_site_option('ldapAttributeNixSearch',LDAP_DEFAULT_ATTRIBUTE_NIXSEARCH); - $this->SetSearchCriteria ("($uid=$in_username)", $attributes_to_get); - } - else { - //Windows - $uid = get_site_option('ldapAttributeWinSearch',LDAP_DEFAULT_ATTRIBUTE_WINSEARCH); - $this->SetSearchCriteria ("($uid=$in_username)", $attributes_to_get); - } + if (get_site_option('ldapLinuxWindows')) + $uid = get_site_option('ldapAttributeNixSearch',LDAP_DEFAULT_ATTRIBUTE_NIXSEARCH); //Linux + else + $uid = get_site_option('ldapAttributeWinSearch',LDAP_DEFAULT_ATTRIBUTE_WINSEARCH); //Windows + + $this->SetSearchCriteria ("($uid=$in_username)", $attributes_to_get); $this->Search(); // Did we find the user? @@ -124,14 +120,12 @@ function DoSearchUsername ($in_username, $attributes_to_get, &$data) { $this->Dock(); - if (get_site_option('ldapLinuxWindows')) { - //Linux - $this->SetSearchCriteria ("(uid=$in_username)", $attributes_to_get); - } - else { - //Windows - $this->SetSearchCriteria ("(samaccountname=$in_username)", $attributes_to_get); - } + if (get_site_option('ldapLinuxWindows')) + $uid = get_site_option('ldapAttributeNixSearch',LDAP_DEFAULT_ATTRIBUTE_NIXSEARCH); //Linux + else + $uid = get_site_option('ldapAttributeWinSearch',LDAP_DEFAULT_ATTRIBUTE_WINSEARCH); //Windows + + $this->SetSearchCriteria ("($uid=$in_username)", $attributes_to_get); $this->Search(); $this->Disconnect(); if ($this->info['count'] > 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <axe...@us...> - 2009-04-07 04:19:36
|
Revision: 75 http://wpmu-ldap.svn.sourceforge.net/wpmu-ldap/?rev=75&view=rev Author: axelseaa Date: 2009-04-07 04:19:17 +0000 (Tue, 07 Apr 2009) Log Message: ----------- changes to allow configurable search attribute Modified Paths: -------------- trunk/ldap/lib/defines.php trunk/ldap/lib/ldap_ro.php trunk/ldap/lib/wpmu_ldap_admin.functions.php Modified: trunk/ldap/lib/defines.php =================================================================== --- trunk/ldap/lib/defines.php 2009-04-02 12:04:33 UTC (rev 74) +++ trunk/ldap/lib/defines.php 2009-04-07 04:19:17 UTC (rev 75) @@ -28,13 +28,14 @@ define ('LDAP_DEFAULT_ATTRIBUTE_GIVENNAME', 'givenname'); define ('LDAP_DEFAULT_ATTRIBUTE_SN', 'sn'); define ('LDAP_DEFAULT_ATTRIBUTE_PHONE', 'phone'); -define ('LDAP_DEFAULT_ATTRIBUTE_HOMEDIR', 'homedirectory'); -define ('LDAP_DEFAULT_ATTRIBUTE_MEMBER', 'member'); +define ('LDAP_DEFAULT_ATTRIBUTE_HOMEDIR', 'homedirectory'); +define ('LDAP_DEFAULT_ATTRIBUTE_MEMBER', 'member'); define ('LDAP_DEFAULT_ATTRIBUTE_MACADDRESS', 'zenwmmacaddress'); define ('LDAP_DEFAULT_ATTRIBUTE_DN', 'dn'); +define ('LDAP_DEFAULT_ATTRIBUTE_NIXSEARCH', 'uid'); +define ('LDAP_DEFAULT_ATTRIBUTE_WINSEARCH', 'samaccountname'); define ('LDAP_DELIM', ","); define ('LDAP_USER_SEARCH_FULLNAME', '0'); define ('LDAP_USER_SEARCH_EMAIL', '1'); define ('LDAP_USER_SEARCH_CN', '2'); -?> Modified: trunk/ldap/lib/ldap_ro.php =================================================================== --- trunk/ldap/lib/ldap_ro.php 2009-04-02 12:04:33 UTC (rev 74) +++ trunk/ldap/lib/ldap_ro.php 2009-04-07 04:19:17 UTC (rev 75) @@ -32,11 +32,13 @@ $attributes_to_get = array ("fullName", "mail", "givenName", "sn", "phone"); if (get_site_option('ldapLinuxWindows')) { //Linux - $this->SetSearchCriteria ("(uid=$in_username)", $attributes_to_get); + $uid = get_site_option('ldapAttributeNixSearch',LDAP_DEFAULT_ATTRIBUTE_NIXSEARCH); + $this->SetSearchCriteria ("($uid=$in_username)", $attributes_to_get); } else { //Windows - $this->SetSearchCriteria ("(samaccountname=$in_username)", $attributes_to_get); + $uid = get_site_option('ldapAttributeWinSearch',LDAP_DEFAULT_ATTRIBUTE_WINSEARCH); + $this->SetSearchCriteria ("($uid=$in_username)", $attributes_to_get); } $this->Search(); Modified: trunk/ldap/lib/wpmu_ldap_admin.functions.php =================================================================== --- trunk/ldap/lib/wpmu_ldap_admin.functions.php 2009-04-02 12:04:33 UTC (rev 74) +++ trunk/ldap/lib/wpmu_ldap_admin.functions.php 2009-04-07 04:19:17 UTC (rev 75) @@ -145,6 +145,8 @@ $ret['ldapAttributeMember'] = get_site_option('ldapAttributeMember',LDAP_DEFAULT_ATTRIBUTE_MEMBER); $ret['ldapAttributeMacaddress'] = get_site_option('ldapAttributeMacaddress',LDAP_DEFAULT_ATTRIBUTE_MACADDRESS); $ret['ldapAttributeDn'] = get_site_option('ldapAttributeDN',LDAP_DEFAULT_ATTRIBUTE_DN); + $ret['ldapAttributeNixSearch'] = get_site_option('ldapAttributeNixSearch',LDAP_DEFAULT_ATTRIBUTE_NIXSEARCH); + $ret['ldapAttributeWinSearch'] = get_site_option('ldapAttributeWinSearch',LDAP_DEFAULT_ATTRIBUTE_WINSEARCH); return $ret; } @@ -500,6 +502,20 @@ <br/> </td> </tr> + <tr valign="top"> + <th scope="row"><label for="ldapAttributeNixSearch">Search Attribute (Linux):</label></th> + <td> + <input type="text" name="ldapAttributeNixSearch" id="ldapAttributeNixSearch" value="<?php echo $ldapAttributeNixSearch ?>" /> + <br/> + </td> + </tr> + <tr valign="top"> + <th scope="row"><label for="ldapAttributeWinSearch">Search Attribute (Windows):</label></th> + <td> + <input type="text" name="ldapAttributeWinSearch" id="ldapAttributeWinSearch" value="<?php echo $ldapAttributeWinSearch ?>" /> + <br/> + </td> + </tr> </table> <p class="submit"><input type="submit" name="ldapOptionsSave" value="Save Attributes" /></p> </form> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <axe...@us...> - 2009-04-02 12:04:41
|
Revision: 74 http://wpmu-ldap.svn.sourceforge.net/wpmu-ldap/?rev=74&view=rev Author: axelseaa Date: 2009-04-02 12:04:33 +0000 (Thu, 02 Apr 2009) Log Message: ----------- minor changes Modified Paths: -------------- trunk/ldap/lib/defines.php Modified: trunk/ldap/lib/defines.php =================================================================== --- trunk/ldap/lib/defines.php 2009-03-21 20:08:57 UTC (rev 73) +++ trunk/ldap/lib/defines.php 2009-04-02 12:04:33 UTC (rev 74) @@ -1,40 +1,40 @@ <?php -define (LDAP_OK, '0'); -define (LDAP_ERROR_NO_PASSWORD, '-1'); -define (LDAP_ERROR_NO_NOVELL_ID, '-2'); -define (LDAP_ERROR_USER_NOT_FOUND, '-3'); -define (LDAP_ERROR_NO_EMAIL_IN_NDS, '-4'); -define (LDAP_ERROR_CONNECTION, '-5'); -define (LDAP_ERROR_WRONG_PASSWORD, '-6'); -define (LDAP_ERROR_EMPTY_PARAM, '-7'); +define ('LDAP_OK', '0'); +define ('LDAP_ERROR_NO_PASSWORD', '-1'); +define ('LDAP_ERROR_NO_NOVELL_ID', '-2'); +define ('LDAP_ERROR_USER_NOT_FOUND', '-3'); +define ('LDAP_ERROR_NO_EMAIL_IN_NDS', '-4'); +define ('LDAP_ERROR_CONNECTION', '-5'); +define ('LDAP_ERROR_WRONG_PASSWORD', '-6'); +define ('LDAP_ERROR_EMPTY_PARAM', '-7'); -define (LDAP_INDEX_EMAIL, '0'); -define (LDAP_INDEX_NAME, '1'); -define (LDAP_INDEX_HOMEDIR, '2'); -define (LDAP_INDEX_MEMBER, '3'); -define (LDAP_INDEX_MACADDRESS, '4'); -define (LDAP_INDEX_GIVEN_NAME, '5'); -define (LDAP_INDEX_SURNAME, '6'); -define (LDAP_INDEX_PHONE, '7'); -define (LDAP_INDEX_HOMEDIR, '8'); -define (LDAP_INDEX_MEMBER, '9'); -define (LDAP_INDEX_MACADDRESS, '10'); -define (LDAP_INDEX_UNIQUE_MEMBER, '11'); -define (LDAP_INDEX_DN, '12'); -define (LDAP_INDEX_LOCATION, '13'); -define (LDAP_INDEX_ROLE, '14'); +define ('LDAP_INDEX_EMAIL', '0'); +define ('LDAP_INDEX_NAME', '1'); +define ('LDAP_INDEX_HOMEDIR', '2'); +define ('LDAP_INDEX_MEMBER', '3'); +define ('LDAP_INDEX_MACADDRESS', '4'); +define ('LDAP_INDEX_GIVEN_NAME', '5'); +define ('LDAP_INDEX_SURNAME', '6'); +define ('LDAP_INDEX_PHONE', '7'); +#define ('LDAP_INDEX_HOMEDIR', '8'); +#define ('LDAP_INDEX_MEMBER', '9'); +#define ('LDAP_INDEX_MACADDRESS', '10'); +define ('LDAP_INDEX_UNIQUE_MEMBER', '11'); +define ('LDAP_INDEX_DN', '12'); +define ('LDAP_INDEX_LOCATION', '13'); +define ('LDAP_INDEX_ROLE', '14'); -define (LDAP_DEFAULT_ATTRIBUTE_MAIL, 'mail'); -define (LDAP_DEFAULT_ATTRIBUTE_GIVENNAME, 'givenname'); -define (LDAP_DEFAULT_ATTRIBUTE_SN, 'sn'); -define (LDAP_DEFAULT_ATTRIBUTE_PHONE, 'phone'); -define (LDAP_DEFAULT_ATTRIBUTE_HOMEDIR, 'homedirectory'); -define (LDAP_DEFAULT_ATTRIBUTE_MEMBER, 'member'); -define (LDAP_DEFAULT_ATTRIBUTE_MACADDRESS, 'zenwmmacaddress'); -define (LDAP_DEFAULT_ATTRIBUTE_DN, 'dn'); +define ('LDAP_DEFAULT_ATTRIBUTE_MAIL', 'mail'); +define ('LDAP_DEFAULT_ATTRIBUTE_GIVENNAME', 'givenname'); +define ('LDAP_DEFAULT_ATTRIBUTE_SN', 'sn'); +define ('LDAP_DEFAULT_ATTRIBUTE_PHONE', 'phone'); +define ('LDAP_DEFAULT_ATTRIBUTE_HOMEDIR', 'homedirectory'); +define ('LDAP_DEFAULT_ATTRIBUTE_MEMBER', 'member'); +define ('LDAP_DEFAULT_ATTRIBUTE_MACADDRESS', 'zenwmmacaddress'); +define ('LDAP_DEFAULT_ATTRIBUTE_DN', 'dn'); -define (LDAP_DELIM, ","); -define (LDAP_USER_SEARCH_FULLNAME, '0'); -define (LDAP_USER_SEARCH_EMAIL, '1'); -define (LDAP_USER_SEARCH_CN, '2'); +define ('LDAP_DELIM', ","); +define ('LDAP_USER_SEARCH_FULLNAME', '0'); +define ('LDAP_USER_SEARCH_EMAIL', '1'); +define ('LDAP_USER_SEARCH_CN', '2'); ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <axe...@us...> - 2009-03-21 20:09:02
|
Revision: 73 http://wpmu-ldap.svn.sourceforge.net/wpmu-ldap/?rev=73&view=rev Author: axelseaa Date: 2009-03-21 20:08:57 +0000 (Sat, 21 Mar 2009) Log Message: ----------- added the ability for ldap attributes to be configured Modified Paths: -------------- trunk/ldap/lib/defines.php trunk/ldap/lib/ldap_core.php trunk/ldap/lib/wpmu_ldap_admin.functions.php Modified: trunk/ldap/lib/defines.php =================================================================== --- trunk/ldap/lib/defines.php 2009-03-21 13:17:34 UTC (rev 72) +++ trunk/ldap/lib/defines.php 2009-03-21 20:08:57 UTC (rev 73) @@ -24,6 +24,15 @@ define (LDAP_INDEX_LOCATION, '13'); define (LDAP_INDEX_ROLE, '14'); +define (LDAP_DEFAULT_ATTRIBUTE_MAIL, 'mail'); +define (LDAP_DEFAULT_ATTRIBUTE_GIVENNAME, 'givenname'); +define (LDAP_DEFAULT_ATTRIBUTE_SN, 'sn'); +define (LDAP_DEFAULT_ATTRIBUTE_PHONE, 'phone'); +define (LDAP_DEFAULT_ATTRIBUTE_HOMEDIR, 'homedirectory'); +define (LDAP_DEFAULT_ATTRIBUTE_MEMBER, 'member'); +define (LDAP_DEFAULT_ATTRIBUTE_MACADDRESS, 'zenwmmacaddress'); +define (LDAP_DEFAULT_ATTRIBUTE_DN, 'dn'); + define (LDAP_DELIM, ","); define (LDAP_USER_SEARCH_FULLNAME, '0'); define (LDAP_USER_SEARCH_EMAIL, '1'); Modified: trunk/ldap/lib/ldap_core.php =================================================================== --- trunk/ldap/lib/ldap_core.php 2009-03-21 13:17:34 UTC (rev 72) +++ trunk/ldap/lib/ldap_core.php 2009-03-21 20:08:57 UTC (rev 73) @@ -171,17 +171,26 @@ } function GetLDAPInfo ($type) { - if ($type == LDAP_INDEX_EMAIL) return $this->info[0]["mail"][0]; - if ($type == LDAP_INDEX_NAME) return $this->info[0]["givenname"][0]." ".$this->info[0]["sn"][0]; - if ($type == LDAP_INDEX_GIVEN_NAME) return $this->info[0]["givenname"][0]; - if ($type == LDAP_INDEX_SURNAME) return $this->info[0]["sn"][0]; - if ($type == LDAP_INDEX_PHONE) return $this->info[0]["phone"]; - if ($type == LDAP_INDEX_HOMEDIR) return $this->info[0]["homedirectory"][0]; - if ($type == LDAP_INDEX_MEMBER) return $this->info[0]["member"]; - if ($type == LDAP_INDEX_MACADDRESS) return $this->info[0]["zenwmmacaddress"]; + $mail = get_site_option('ldapAttributeMail',LDAP_DEFAULT_ATTRIBUTE_MAIL); + $givenname = get_site_option('ldapAttributeGivenname',LDAP_DEFAULT_ATTRIBUTE_GIVENNAME); + $sn = get_site_option('ldapAttributeSn',LDAP_DEFAULT_ATTRIBUTE_SN); + $phone = get_site_option('ldapAttributePhone',LDAP_DEFAULT_ATTRIBUTE_PHONE); + $homedir = get_site_option('ldapAttributeHomedir',LDAP_DEFAULT_ATTRIBUTE_HOMEDIR); + $member = get_site_option('ldapAttributeMember',LDAP_DEFAULT_ATTRIBUTE_MEMBER); + $macaddress = get_site_option('ldapAttributeMacaddress',LDAP_DEFAULT_ATTRIBUTE_MACADDRESS); + $dn = get_site_option('ldapAttributeDn',LDAP_DEFAULT_ATTRIBUTE_DN); + + if ($type == LDAP_INDEX_EMAIL) return $this->info[0][$mail][0]; + if ($type == LDAP_INDEX_NAME) return $this->info[0][$givenname][0]." ".$this->info[0][$sn][0]; + if ($type == LDAP_INDEX_GIVEN_NAME) return $this->info[0][$givenname][0]; + if ($type == LDAP_INDEX_SURNAME) return $this->info[0][$sn][0]; + if ($type == LDAP_INDEX_PHONE) return $this->info[0][$phone]; + if ($type == LDAP_INDEX_HOMEDIR) return $this->info[0][$homedir][0]; + if ($type == LDAP_INDEX_MEMBER) return $this->info[0][$member]; + if ($type == LDAP_INDEX_MACADDRESS) return $this->info[0][$macaddress]; // When dealing with "uniqueMember", LDAP actually returns it as "member" - they're synonyms - if ($type == LDAP_INDEX_UNIQUE_MEMBER) return $this->info[0][member]; - if ($type == LDAP_INDEX_DN) return $this->info[0]["dn"]; + if ($type == LDAP_INDEX_UNIQUE_MEMBER) return $this->info[0][$member]; + if ($type == LDAP_INDEX_DN) return $this->info[0][$dn]; } } ?> Modified: trunk/ldap/lib/wpmu_ldap_admin.functions.php =================================================================== --- trunk/ldap/lib/wpmu_ldap_admin.functions.php 2009-03-21 13:17:34 UTC (rev 72) +++ trunk/ldap/lib/wpmu_ldap_admin.functions.php 2009-03-21 20:08:57 UTC (rev 73) @@ -32,7 +32,7 @@ <?php wpmuLdapOptionsMenu($tab); if ($tab == 'attributes') { - + ldapAttributeMapping(); } elseif ($tab == 'upgrade') { ldapOptionsPanelUpdates(); } elseif ($tab == 'general') { @@ -50,7 +50,7 @@ echo '<p>'; echo '<a href="?page=wpmu_ldap_admin.functions.php"'.((empty($tab) || $tab == 'connection') ? ' class="wpmuLdapOptionMenuSelected"' : '').'>Connection Settings</a> | '; echo '<a href="?page=wpmu_ldap_admin.functions.php&ldaptab=general"'.($tab == 'general' ? ' class="wpmuLdapOptionMenuSelected"' : '').'>General Settings</a> | '; - #echo '<a href="?page=wpmu_ldap_admin.functions.php&ldaptab=attributes"'.($tab == 'attributes' ? ' class="wpmuLdapOptionMenuSelected"' : '').'>Attribute Mapping</a> | '; + echo '<a href="?page=wpmu_ldap_admin.functions.php&ldaptab=attributes"'.($tab == 'attributes' ? ' class="wpmuLdapOptionMenuSelected"' : '').'>Attribute Mapping</a> | '; echo '<a href="?page=wpmu_ldap_admin.functions.php&ldaptab=upgrade"'.($tab == 'upgrade' ? ' class="wpmuLdapOptionMenuSelected"' : '').'>Upgrade</a>'; echo '</p><hr/>'; } @@ -137,6 +137,14 @@ $ret['ldapfixmetafor15'] = get_site_option('ldapfixmetafor15'); $ret['ldapBulkAdd'] = get_site_option('ldapBulkAdd'); $ret['ldapPublicDisplayName'] = get_site_option('ldapPublicDisplayName'); + $ret['ldapAttributeMail'] = get_site_option('ldapAttributeMail',LDAP_DEFAULT_ATTRIBUTE_MAIL); + $ret['ldapAttributeGivenname'] = get_site_option('ldapAttributeGivenname',LDAP_DEFAULT_ATTRIBUTE_GIVENNAME); + $ret['ldapAttributeSn'] = get_site_option('ldapAttributeSn',LDAP_DEFAULT_ATTRIBUTE_SN); + $ret['ldapAttributePhone'] = get_site_option('ldapAttributePhone',LDAP_DEFAULT_ATTRIBUTE_PHONE); + $ret['ldapAttributeHomedir'] = get_site_option('ldapAttributeHomedir',LDAP_DEFAULT_ATTRIBUTE_HOMEDIR); + $ret['ldapAttributeMember'] = get_site_option('ldapAttributeMember',LDAP_DEFAULT_ATTRIBUTE_MEMBER); + $ret['ldapAttributeMacaddress'] = get_site_option('ldapAttributeMacaddress',LDAP_DEFAULT_ATTRIBUTE_MACADDRESS); + $ret['ldapAttributeDn'] = get_site_option('ldapAttributeDN',LDAP_DEFAULT_ATTRIBUTE_DN); return $ret; } @@ -429,7 +437,73 @@ <?php } -function ldapOptionsPanelAttributes() { +function ldapAttributeMapping() { + extract(getWpmuLdapSiteOptions()); +?> + <form method="post" id="ldap_auth_options"> + <h3>LDAP Attribute Mapping</h3> + <p>This page will allow you to modify which ldap attribute the plugin uses to populate default values for the user.</p> + <table class="form-table"> + <tr valign="top"> + <th scope="row"><label for="ldapAttributeMail">Email:</label></th> + <td> + <input type="text" name="ldapAttributeMail" id="ldapAttributeMail" value="<?php echo $ldapAttributeMail ?>" /> + <br/> + </td> + </tr> + <tr valign="top"> + <th scope="row"><label for="ldapAttributeGivenname">Givenname (Firstname):</label></th> + <td> + <input type="text" name="ldapAttributeGivenname" id="ldapAttributeGivenname" value="<?php echo $ldapAttributeGivenname ?>" /> + <br/> + </td> + </tr> + <tr valign="top"> + <th scope="row"><label for="ldapAttributeSn">Surname (Lastname):</label></th> + <td> + <input type="text" name="ldapAttributeSn" id="ldapAttributeSn" value="<?php echo $ldapAttributeSn ?>" /> + <br/> + </td> + </tr> + <tr valign="top"> + <th scope="row"><label for="ldapAttributePhone">Phone:</label></th> + <td> + <input type="text" name="ldapAttributePhone" id="ldapAttributePhone" value="<?php echo $ldapAttributePhone ?>" /> + <br/> + </td> + </tr> + <tr valign="top"> + <th scope="row"><label for="ldapAttributeHomedir">Home Directory:</label></th> + <td> + <input type="text" name="ldapAttributeHomedir" id="ldapAttributeHomedir" value="<?php echo $ldapAttributeHomedir ?>" /> + <br/> + </td> + </tr> + <tr valign="top"> + <th scope="row"><label for="ldapAttributeMember">Member:</label></th> + <td> + <input type="text" name="ldapAttributeMember" id="ldapAttributeMember" value="<?php echo $ldapAttributeMember ?>" /> + <br/> + </td> + </tr> + <tr valign="top"> + <th scope="row"><label for="ldapAttributeMacaddress">Mac Address:</label></th> + <td> + <input type="text" name="ldapAttributeMacaddress" id="ldapAttributeMacaddress" value="<?php echo $ldapAttributeMacaddress ?>" /> + <br/> + </td> + </tr> + <tr valign="top"> + <th scope="row"><label for="ldapAttributeDn">Distinguished Name (DN):</label></th> + <td> + <input type="text" name="ldapAttributeDn" id="ldapAttributeDn" value="<?php echo $ldapAttributeDn ?>" /> + <br/> + </td> + </tr> + </table> + <p class="submit"><input type="submit" name="ldapOptionsSave" value="Save Attributes" /></p> + </form> +<?php } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <axe...@us...> - 2009-03-21 13:17:54
|
Revision: 72 http://wpmu-ldap.svn.sourceforge.net/wpmu-ldap/?rev=72&view=rev Author: axelseaa Date: 2009-03-21 13:17:34 +0000 (Sat, 21 Mar 2009) Log Message: ----------- added display name config option - also updated wording on email notification for local users Modified Paths: -------------- trunk/ldap/lib/wpmu_ldap.functions.php trunk/ldap/lib/wpmu_ldap_admin.functions.php Modified: trunk/ldap/lib/wpmu_ldap.functions.php =================================================================== --- trunk/ldap/lib/wpmu_ldap.functions.php 2009-03-15 19:50:30 UTC (rev 71) +++ trunk/ldap/lib/wpmu_ldap.functions.php 2009-03-21 13:17:34 UTC (rev 72) @@ -30,6 +30,14 @@ update_usermeta( $user_id, 'first_name', $ldapUserData[LDAP_INDEX_GIVEN_NAME] ); update_usermeta( $user_id, 'last_name', $ldapUserData[LDAP_INDEX_SURNAME] ); update_usermeta( $user_id, 'ldap_login', 'true' ); + + $displayName = get_site_option('ldapPublicDisplayName'); + if (!empty($displayName)) { + if ($displayName == 'username') update_usermeta( $user_id, 'display_name', $newUserName); + if ($displayName == 'first') update_usermeta( $user_id, 'display_name', $ldapUserData[LDAP_INDEX_GIVEN_NAME]); + if ($displayName == 'firstlast') update_usermeta( $user_id, 'display_name', $ldapUserData[LDAP_INDEX_GIVEN_NAME].' '.$ldapUserData[LDAP_INDEX_SURNAME]); + if ($displayName == 'lastfirst') update_usermeta( $user_id, 'display_name', $ldapUserData[LDAP_INDEX_SURNAME].' '.$ldapUserData[LDAP_INDEX_GIVEN_NAME]); + } else update_usermeta( $user_id, 'display_name', $newUserName); //This is for plugin events do_action('wpmu_activate_user', $user_id, $newUserPassword, false); Modified: trunk/ldap/lib/wpmu_ldap_admin.functions.php =================================================================== --- trunk/ldap/lib/wpmu_ldap_admin.functions.php 2009-03-15 19:50:30 UTC (rev 71) +++ trunk/ldap/lib/wpmu_ldap_admin.functions.php 2009-03-21 13:17:34 UTC (rev 72) @@ -136,6 +136,7 @@ $ret['ldapGetPasswordMessage'] = stripslashes(get_site_option('ldapGetPasswordMessage', $defaultGetPasswordMessage)); $ret['ldapfixmetafor15'] = get_site_option('ldapfixmetafor15'); $ret['ldapBulkAdd'] = get_site_option('ldapBulkAdd'); + $ret['ldapPublicDisplayName'] = get_site_option('ldapPublicDisplayName'); return $ret; } @@ -169,6 +170,9 @@ if($ldapCreateLocalUser) $tCreateLocalUser = "checked='checked'"; else $fCreateLocalUser = "checked='checked'"; + if($ldapPublicDisplayName) $displayNameSelect = $ldapPublicDisplayName; + else $displayNameSelect = false; + ?> <form method="post" id="ldap_auth_options"> @@ -245,13 +249,26 @@ This is the error message that would be displayed when an LDAP-account user submits "Lost Password" requests. </td> </tr> + <tr> + <th scope="row"><label for="ldapPublicDisplayName">Public Display Name Format:</label></th> + <td> + <select id="ldapPublicDisplayName" name="ldapPublicDisplayName"> + <option value='username' <?php echo $displayNameSelect == 'username' ? ' selected="selected"' : ''; ?>>username</option> + <option value='first' <?php echo $displayNameSelect == 'first' ? ' selected="selected"' : ''; ?>>firstname</option> + <option value='firstlast' <?php echo $displayNameSelect == 'firstlast' ? ' selected="selected"' : ''; ?>>firstname lastname</option> + <option value='lastfirst' <?php echo $displayNameSelect == 'lastfirst' ? ' selected="selected"' : ''; ?>>lastname firstname</option> + </select> + <br/> + Sets the default display name format to use for new account creations. + </td> + </tr> <tr valign="top"> <th scope="row">New user email notification (Local Users):</th> <td> <input type='radio' name='ldapLocalEmail' id='disableLocalEmailYes' value='1' <?php echo $tLocalEmail; ?>/> <label for="disableLocalEmailYes">Yes</label> <input type='radio' name='ldapLocalEmail' id='disableLocalEmailNo' value='0' <?php echo $fLocalEmail; ?>/> <label for="disableLocalEmailNo">No</label> <br/> - Controls whether or not local users are emailed on account creation or when receiving access to a new blog. + Controls whether or not local users are emailed on account creation or when receiving access to a new blog. It is recommended to set this to yes, otherwise local users will not receive their password when created. <br/><br/> <label for="ldapLocalEmailSubj">Email Subject:</label><br/> <input type="text" name="ldapLocalEmailSubj" id="ldapLocalEmailSubj" value="<?php echo $ldapLocalEmailSubj ?>" /><br /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |