[Bps-public-commit] r16702 - in RT-Authen-ExternalAuth/trunk: html/Callbacks/ExternalAuth/autohandler

zordrak at bestpractical.com zordrak at bestpractical.com
Thu Nov 6 06:46:39 EST 2008


Author: zordrak
Date: Thu Nov  6 06:46:37 2008
New Revision: 16702

Modified:
   RT-Authen-ExternalAuth/trunk/html/Callbacks/ExternalAuth/autohandler/Auth
   RT-Authen-ExternalAuth/trunk/lib/RT/User_Vendor.pm

Log:
zordrak | 2008-11-06 11:15:00 +0000
 * 0.07_01-prealpha
 * Perl reports all Syntax OK
 * Going to set up a test rig to start testing the code's interaction with RT.

Modified: RT-Authen-ExternalAuth/trunk/html/Callbacks/ExternalAuth/autohandler/Auth
==============================================================================
--- RT-Authen-ExternalAuth/trunk/html/Callbacks/ExternalAuth/autohandler/Auth	(original)
+++ RT-Authen-ExternalAuth/trunk/html/Callbacks/ExternalAuth/autohandler/Auth	Thu Nov  6 06:46:37 2008
@@ -2,15 +2,18 @@
 
 use RT::Authen::ExternalAuth;
 
+# Since refactoring at 0.07_01 I believe the following workaround is now not required.
+######################################################################################
 # If the RT::User::UpdateFromExternal method is not available, then we are in
 # RT-3.8.0 or RT-3.8.1 and we need to work around a bug in the plugin system:
 # Temporarily force RT to reload RT::User, since it isn't being loaded
 # correctly as a plugin.
-unless (RT::User->can('UpdateFromExternal')) {
-    $RT::Logger->error("Working around bug in RT and reloading RT::User");
-    delete $INC{'RT/User.pm'};
-    require RT::User;
-}
+#unless (RT::User->can('UpdateFromExternal')) {
+#    $RT::Logger->error("Working around bug in RT and reloading RT::User");
+#    delete $INC{'RT/User.pm'};
+#    require RT::User;
+#}
+######################################################################################
 
 # If the user is logging in, let's authenticate; if they can auth but don't load
 # (e.g. they don't have an account but external auth succeeds), we'll autocreate
@@ -18,44 +21,35 @@
 unless ($session{'CurrentUser'}) {
     
     # Password has not been confirmed valid until we say so
-    my $password_validated;
-
-    # This WAS used to stop a pointless LookupExternalUserInfo
-    # called by UpdateFromExternal later on since it's already
-    # called by RT::User::Create if the user is autocreated
-    # but this has been deprecated pending a little bit of a
-    # rewrite since I realised that we're not calling
-    # CanonicalizeUserInfo but UpdateFromExternal which is the
-    # only code that checks whether the user is externally
-    # marked as disabled.
-    my $user_autocreated = 0;
+    my $password_validated = 0;
 
     # If $user has been passed by login page, 
     # or any other custom code previous to this
     if (defined ($user)) {
         $session{'CurrentUser'} = RT::CurrentUser->new();
+        
+        # Does user exist internally?
         $session{'CurrentUser'}->Load($user);
 
         # Unless we have loaded a valid user with a UserID
         unless ($session{'CurrentUser'}->Id) {
+            
             # Check if user exists externally - autocreate user if it does
-           
             if(RT::Authen::ExternalAuth->UserExists($user)){
-                    my ($val, $msg) = 
-                      $UserObj->Create(%{ref($RT::AutoCreate) ? $RT::AutoCreate : {}},
-                                       Name   => $user,
-                                       Gecos  => $user,
-                                      );
-                    unless ($val) {
-                        $RT::Logger->error( "Couldn't create user $user: $msg" );
-                        return;
-                    }
-                    $RT::Logger->info(  "Autocreated authenticated user",
-                                        $UserObj->Name,
-                                        "(",
-                                        $UserObj->Id,
-                                        ")");
-                    $user_autocreated = 1;
+                my ($val, $msg) = 
+                  $UserObj->Create(%{ref($RT::AutoCreate) ? $RT::AutoCreate : {}},
+                                   Name   => $user,
+                                   Gecos  => $user,
+                                  );
+                unless ($val) {
+                    $RT::Logger->error( "Couldn't create user $user: $msg" );
+                    return;
+                }
+                $RT::Logger->info(  "Autocreated authenticated user",
+                                    $UserObj->Name,
+                                    "(",
+                                    $UserObj->Id,
+                                    ")");
             }
 
             my ($val, $msg) = $UserObj->SetName($user);

Modified: RT-Authen-ExternalAuth/trunk/lib/RT/User_Vendor.pm
==============================================================================
--- RT-Authen-ExternalAuth/trunk/lib/RT/User_Vendor.pm	(original)
+++ RT-Authen-ExternalAuth/trunk/lib/RT/User_Vendor.pm	Thu Nov  6 06:46:37 2008
@@ -1,10 +1,3 @@
-### User_Vendor.pm
-# Overlay for RT::User object as part of RT::Authen::ExternalAuth
-#
-# Originally based on User_Local.pm for LDAP created by Jim Meyer (purp at acm.org) and found at:
-#   http://wiki.bestpractical.com/view/LdapUserLocalOverlay
-
-
 no warnings qw(redefine);
 use strict;
 use RT::Authen::ExternalAuth;



More information about the Bps-public-commit mailing list