WordPress.org

Ready to get started?Download WordPress

Forums

Simple LDAP Authentication
Patch to update role affiliation via LDAP (1 post)

  1. garnser
    Member
    Posted 2 years ago #

    Hi,

    I've created this patch to allow updates of role affiliation upon login using LDAP authentication, if possible please add upstreams.

    --- simple-ldap-authentication.php.old	2012-06-18 23:41:44.000000000 +0200
    +++ simple-ldap-authentication.php	2012-06-18 23:41:15.000000000 +0200
    @@ -201,8 +201,12 @@
     					@ldap_unbind($ldap);
     					return new WP_Error('invalid_username', __('<strong>ERROR</strong>: This user exists in LDAP, but has not been granted access to this installation of WordPress.', $this->ldap_auth_domain));
     				}
    +			} else {
    +			  $user_role = $this->_get_user_role_equiv($ldap, $username);
    +			  $user_id = username_exists($username);
    +			  wp_update_user( array('ID' => $user_id, 'role' => $user_role));
     			}
    -
    +
     			@ldap_unbind($ldap);
     		}

    http://wordpress.org/extend/plugins/simple-ldap-authentication/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags