WordPress.org

Ready to get started?Download WordPress

Forums

wpDirAuth
wpDirAuth 1.6 Update (30 posts)

  1. mendocinoWebmaster
    Member
    Posted 3 years ago #

    wpDirAuth is working fine for us, but I see a 1.6 update is now available. I can't find much in the way of a changelog or really any information from the current developer, Paul Gilzow.

    The Trac revision log for 2011-03-11 mentions:

    Added ability to pre-add directory authenticated users
    http://plugins.trac.wordpress.org/log/wpdirauth/

    I'm hesitant to update due to the lack of information. Has anybody else updated with success or failure? Does this update provide the ability to add all LDAP users to WP? Who is Paul Gilzow? Why do I smell smoke?

    http://wordpress.org/extend/plugins/wpdirauth/

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 3 years ago #

    http://wordpress.org/extend/plugins/wpdirauth/changelog/ shows this:

    1.6.0
    Added Add Dir Auth User to Admin User menu. Now able to pre-add Directory Authenticated users and assign roles where previously users would have to log in first, and then have an admin change their role.

  3. mendocinoWebmaster
    Member
    Posted 3 years ago #

    Thanks. I must have been looking at cache.

  4. cewyattjr
    Member
    Posted 3 years ago #

    Ummm, we installed 1.6 and had to back it out. In the Apache log we were getting an LDAP cannot connect message, our sys admin reports. When users attempted to login they would just see:

    "Directory authentication initially succeeded, but no valid profile was found (search procedure)."

    Sad face. :-(

  5. gilzow
    Member
    Plugin Author

    Posted 3 years ago #

    @mendocinoWebmaster There was some issue with the wordpress plugin directory. The changelog and updated information was in the readme.txt but for some reason, the directory wasnt pulling the updated information. Otto did something to correct it so it is now showing on the wordpress directory.

    The new functionality: in the previous versions, if you wanted to add a new Editor (or any user with a role), you were required to have them log in first (since the script creates a new WP User if the directory authenticated username didnt exist in the WP Users table) and after they logged in, change their user role. I personally wanted the ability to add a directory authenticated user AND give them a role before they logged in, and then have it email this user to let them know they had been added to the site.

    So no, it wont add all of your AD users to your wordpress site. But it should make the process of adding a new AD user that should have an elevated role easier to manage.

    As for who I am, I'm a programmer/Analyst at the University of Missouri. If you search for my name on Google, the first two pages of results are all connected to me. :)

  6. mendocinoWebmaster
    Member
    Posted 3 years ago #

    @gilzow Thanks for the information. I thought I pulled a rookie move for a minute.

    I dig the idea of the new feature, but I'm also getting connection errors when trying to add users.

    As an aside, we're not on AD. Is AD where you're going with this plugin? I'll roll back and stop updating if that's the case.

    LDAP is a pain and I applaud your efforts!

  7. gilzow
    Member
    Plugin Author

    Posted 3 years ago #

    @cewyattjr can you give me some details on how you have wpdirauth configured? That specific error means that the plugin was able to connect to your DC, was able to bind with the passed ssoid/password but that when it searched for the user's details (sn, givenname, mail) that the DC returned an error. So it's odd that the Apache logs would show that LDAP was unable to connect since the users wouldnt (or shouldnt) have been able to get that far without a valid connection.

    If you want, open up wpdirauth.php, go to line 1411, and change it from
    ." [$strFilter]");
    to
    ." [$strFilter]" . "[".ldap_error($rscConnection)."]");

    Have a user try to log in, and then let me know what the error message says.

  8. gilzow
    Member
    Plugin Author

    Posted 3 years ago #

    @mendocinoWebmaster AD is what I have access to but isnt necessarily where I'm moving the plugin to.

    Connection issues, huh? The new feature uses the same function to establish the connection as the normal authentication. Which error message are you receiving?

  9. mendocinoWebmaster
    Member
    Posted 3 years ago #

    Directory Authentication Error:
    * For an unknow reason, WP failed to create a new user. Failure occurred at line 1536 in the function wpDirAuth_add_new_user in the file wpDirAuth.php.

    So, the user ID returned isn't an integer. If I play with the return from if(!is_int($intUserID)){ (line 1534) I get:

    Directory Authentication Error:
    * Cannot create a user with an empty login name.

    I don't work in PHP a whole lot and this was just a cursory glance, but maybe it'll help.

  10. gilzow
    Member
    Plugin Author

    Posted 3 years ago #

    Absolutely does. That means there was an issue creating the user via wp_update_user() function.

    Can you try something for me? Before line 1532 which contains:
    $intUserID = wp_update_user($aryUserDetails);
    can you add the following?

    if(!function_exists('wp_update_user')){
          include_once(ABSPATH . WPINC . '/registration.php');
      }

    and then try adding a new user again.

    If this fixes things, it means I made an incorrect assumption and will need to issue a bug fix.

  11. mendocinoWebmaster
    Member
    Posted 3 years ago #

    No go. Same error.

    I've now tried with anonymous and admin binding.

  12. gilzow
    Member
    Plugin Author

    Posted 3 years ago #

    Well then, for some reason, there's a wordpress failure in creating the user. Is this happening with EVERY user you're trying to add? Or just a specific one? Is it possible this person(s) is missing information in their LDAP entry (especially email)?

    I'm going to guess this is a production site. Is there a point where it has some downtime where you could enable WP_DEBUG in you wp-config file so we can see what additional errors might be occurring?

  13. mendocinoWebmaster
    Member
    Posted 3 years ago #

    This is happening with all attempts to manually add. Tweaking the return data on the error gave me the full, appropriate email address.

    People who log in with their LDAP credentials have an account created correctly.

    After digging through the WP code I decided to change the $intUserID = wp_update_user($aryUserDetails); line to $intUserID = wp_insert_user($aryUserDetails); and it seems to be working. What do you think?

    Thanks for all the help, Paul!

  14. gilzow
    Member
    Plugin Author

    Posted 3 years ago #

    ok, that makes no sense. wp_update_user uses wp_insert_user so it should be failing as well. What version of wordpress are you on?

    of course, both wp_update_user and wp_insert_user state that they can either create a new user or update a current user so i'm not really sure why they both exist.

    Looked through the wp core files. Dont see any reason why I couldnt just use wp_insert_user over wp_update_user though I'm still confused as to why it wont work. Will probably push out 1.6.1 as a bug fix then and change it to wp_insert_user.

  15. jgiangrande
    Member
    Posted 3 years ago #

    I believe I have found a solution to the problem mentioned by cewyattjr. It seems the wpDirAuth_auth function never sets the $strFilterQuery variable if the "Authentication Groups" configuration field is empty. This variable is used as the LDAP search filter by the wpDirAuth_retrieveUserDetails command. Adding the following else statement at line 480 appears to have fixed the bug for us.

    if($boolUseGroups == 1){
        // UseGroups code
    } else {
        $strFilterQuery = $filterQuery;
    }
  16. gilzow
    Member
    Plugin Author

    Posted 3 years ago #

    ah crap. good catch. Actually, it looks like $strFilterQuery should be $filterQuery. The joys of taking over someone elses code and having a different naming schema. Let me make the changes and I'll push out a bug fix.

  17. gilzow
    Member
    Plugin Author

    Posted 3 years ago #

    Bug fix pushed out as 1.6.1. Sorry for the inconvenience.

  18. cewyattjr
    Member
    Posted 3 years ago #

    Nice... thanks all!

  19. mendocinoWebmaster
    Member
    Posted 3 years ago #

    We're on the latest, WP 3.1

    The initial failures stemmed from the fact that there is no user ID value. The wp_update_user function also relies on this null user ID.

  20. gilzow
    Member
    Plugin Author

    Posted 3 years ago #

    @mendocinoWebmaster except that wp_update_user is supposed to add that (null for ID) before passing it to wp_insert_user. From the inline documentation:

    * If $userdata does not contain an 'ID' key, then a new user will be created
    * and the new user's ID will be returned.

    In looking at the actual code, the ONLY difference I can find between the two is that wp_update_user will hash the password if updating a user's password whereas wp_insert_user does not. And if the current user is updating their own password it clears their cookies and recreates them, where wp_insert_user doesnt touch cookies.

    As long as I'm not overlooking something and that really is the only purpose to wp_udate_user (eg handling updates to passwords) then I'll switch wpdirauth to using wp_insert_user.

    BTW, I pushed 1.6.1 out on friday but it's still not showing up inside wordpress installs or in the wordpress plugin directory. Not sure what's going on.

  21. mendocinoWebmaster
    Member
    Posted 3 years ago #

    Yeah, looking at the code it seems the aims of the two functions are pretty similar, though wp_insert_user is more robust. Seems like a friendliness/efficiency trade-off. Both functions try to serve both purposes, but insert does it better.

    I noticed the update wasn't available. My hacks are working though, so I've got patience to spare.

    Thanks.
    -dave

  22. cewyattjr
    Member
    Posted 3 years ago #

    Hmmm, not seeing the patch posted yet? Thanks!!!

  23. cewyattjr
    Member
    Posted 3 years ago #

    See it now, sorry false alarm. The label on the download button isn't updated, but all else looks good. Thank you!!!

  24. gilzow
    Member
    Plugin Author

    Posted 3 years ago #

    @cewyattjr i think the wordpress directory hates me. This is the second time I've made an update and the directory hasnt updated. :(

  25. Samuel Wood (Otto)
    Tech Ninja
    Posted 3 years ago #

    The directory doesn't hate you, you just made your change incorrectly.

    http://plugins.svn.wordpress.org/wpdirauth/tags/1.6.1/wpDirAuth.php still says version 1.6.0 in it.

  26. gilzow
    Member
    Plugin Author

    Posted 3 years ago #

    /sigh

    I thought the documentation said that the plugin directory goes off the "Stable Tag" in the readme.txt file in the trunk, which is correct:

    http://plugins.svn.wordpress.org/wpdirauth/trunk/readme.txt

    I'm getting ready to do 1.6.2 anyway, so I'll just correct it then.

    Thanks for the info Otto.

  27. Samuel Wood (Otto)
    Tech Ninja
    Posted 3 years ago #

    The Stable Tag points to where the current version of the plugin is. But the version and other such stuff is read from the plugin itself.

  28. jack_greene
    Member
    Posted 3 years ago #

    Can you please help me (this thread gets confusing)

    I've downloaded and am using 1.6.1 and for new users logging in, no problem but when I use the "Add Dir Auth User" button.

    Directory Authentication Error:
    For an unknow reason, WP failed to create a new user. Failure occurred at line 1536 in the function wpDirAuth_add_new_user in the file wpDirAuth.php.

    I've tried some of the patches listed and no change. I'd be willing to test 1.6.2, we're just rolling out a new site and our CM could really use this function.

  29. gilzow
    Member
    Plugin Author

    Posted 3 years ago #

    Jack_greene, find the line
    $intUserID = wp_update_user($aryUserDetails);
    (should be line 1532) and change it to
    $intUserID = wp_insert_user($aryUserDetails);
    and then try it again.

  30. jack_greene
    Member
    Posted 3 years ago #

    Thank You! That's the fix (for me at least).

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic