[Bps-public-commit] rt-authen-externalauth branch, multiple-emails, updated. 0.09-34-gddd96ec

Ruslan Zakirov ruz at bestpractical.com
Wed May 11 16:45:44 EDT 2011


The branch, multiple-emails has been updated
       via  ddd96ec7ceae8c63255f49d320d14683caa2f256 (commit)
      from  cc472bb570cc82d15a010f97a8b08c767b907c67 (commit)

Summary of changes:
 lib/RT/Authen/ExternalAuth.pm |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

- Log -----------------------------------------------------------------
commit ddd96ec7ceae8c63255f49d320d14683caa2f256
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu May 12 00:41:27 2011 +0400

    bring AutoCreate option into ::Interface::Email::CreateUser()
    
    Workaround for a bug in RT. When a user that is not in the DB
    submits a ticket via Email then a new account created without
    AutoCreate config option.

diff --git a/lib/RT/Authen/ExternalAuth.pm b/lib/RT/Authen/ExternalAuth.pm
index 2a6d922..9b66a0e 100644
--- a/lib/RT/Authen/ExternalAuth.pm
+++ b/lib/RT/Authen/ExternalAuth.pm
@@ -438,6 +438,8 @@ sub CanonicalizeUserInfo {
     my $UserObj = shift;
     my $args    = shift;
 
+    WorkaroundAutoCreate( $UserObj, $args );
+
     my $current_value = sub {
         my $field = shift;
         return $args->{ $field } if keys %$args;
@@ -656,4 +658,20 @@ sub CanonicalizeUserInfo {
     };
 }
 
+sub WorkaroundAutoCreate {
+    my $user = shift;
+    my $args = shift;
+
+    # CreateUser in RT::Interface::Email doesn't account $RT::AutoCreate
+    # config option. Let's workaround it.
+
+    return unless $RT::AutoCreate && keys %$RT::AutoCreate;
+    return unless keys %$args; # no args - update
+    return unless (caller(4))[3] eq 'RT::Interface::Email::CreateUser';
+
+    my %tmp = %$RT::AutoCreate;
+    delete @tmp{qw(Name EmailAddress RealName Comments)};
+    %$args = (%$args, %$RT::AutoCreate);
+}
+
 1;

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list