Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- ExternalAuth.pm 2011-08-29 11:06:30.000000000 -0300
- +++ ExternalAuth.pm 2011-10-03 15:04:01.000000000 -0300
- @@ -112,18 +112,22 @@
- # We are now sure that we're talking about a valid RT user.
- # If the user already exists, load up their info. If they don't
- # then we need to create the user in RT.
- -
- + #MODIF
- + my $MagicUid = "a";
- + #END_MODIF
- # Does user already exist internally to RT?
- + $RT::Logger->debug("Auto-Create process, this is where the magic really happens!! Put the A letter befone the UID");
- $session->{'CurrentUser'} = RT::CurrentUser->new();
- - $session->{'CurrentUser'}->Load($username);
- -
- + $session->{'CurrentUser'}->Load($MagicUid . $username);
- + #$session->{'CurrentUser'}->Load($username);
- +
- # Unless we have loaded a valid user with a UserID create one.
- unless ($session->{'CurrentUser'}->Id) {
- my $UserObj = RT::User->new($RT::SystemUser);
- my ($val, $msg) =
- $UserObj->Create(%{ref($RT::AutoCreate) ? $RT::AutoCreate : {}},
- - Name => $username,
- - Gecos => $username,
- + Name => ("a" . $username),
- + Gecos => $username,
- );
- unless ($val) {
- $RT::Logger->error( "Couldn't create user $username: $msg" );
- @@ -138,9 +142,9 @@
- $RT::Logger->debug("Loading new user (",
- $username,
- ") into current session");
- - $session->{'CurrentUser'}->Load($username);
- + $session->{'CurrentUser'}->Load("a" . $username);
- + $RT::Logger->debug("Did the system load the the userseme with a ? Otherwise the next step will fail.");
- }
- -
- ####################################################################
- ########## Authentication ##########################################
- ####################################################################
- @@ -279,7 +283,8 @@
- # Update their info from external service using the username as the lookup key
- # CanonicalizeUserInfo will work out for itself which service to use
- # Passing it a service instead could break other RT code
- - my %args = (Name => $username);
- + #MODIFICACAO - Incluido o substring no $username para remover o caracter a
- + my %args = (Name => substr($username,1));
- $UserObj->CanonicalizeUserInfo(\%args);
- # For each piece of information returned by CanonicalizeUserInfo,
- @@ -295,10 +300,10 @@
- # uncomment the following logging statements
- if ($method_success) {
- # At DEBUG level, log that method succeeded
- - # $RT::Logger->debug((caller(0))[3],"$method Succeeded. $method_msg");
- + $RT::Logger->debug((caller(0))[3],"$method Succeeded. $method_msg");
- } else {
- # At DEBUG level, log that method failed
- - # $RT::Logger->debug((caller(0))[3],"$method Failed. $method_msg");
- + $RT::Logger->debug((caller(0))[3],"$method Failed. $method_msg");
- }
- }
- @@ -343,7 +348,8 @@
- # Request a username/password check from the specified service
- # This is only valid for non-SSO services.
- -
- +# my $removemagic = substr($username, 1);
- +# my ($removemagic,$service) = @_;
- my ($username,$service) = @_;
- my $success = 0;
- @@ -356,7 +362,9 @@
- if ($config->{'type'} eq 'db') {
- $success = RT::Authen::ExternalAuth::DBI::UserExists($username,$service);
- } elsif ($config->{'type'} eq 'ldap') {
- - $success = RT::Authen::ExternalAuth::LDAP::UserExists($username,$service);
- + my $magicnewname = substr($username, '0', 8);
- + my $username = $magicnewname;
- + $success = RT::Authen::ExternalAuth::LDAP::UserExists($username,$service);
- } else {
- $RT::Logger->debug("Invalid service type for UserExists:",$service);
- }
- @@ -365,7 +373,7 @@
- }
- sub UserDisabled {
- -
- + $RT::Logger->debug("Now is starting UserDisabled function");
- my $username = shift;
- my $user_disabled = 0;
- @@ -403,8 +411,8 @@
- $user_disabled = RT::Authen::ExternalAuth::DBI::UserDisabled($username,$service);
- } elsif ($config->{'type'} eq 'ldap') {
- -
- - unless(RT::Authen::ExternalAuth::LDAP::UserExists($username,$service)) {
- + $RT::Logger->debug("Removing special character A from the username.");
- + unless(RT::Authen::ExternalAuth::LDAP::UserExists(substr($username,1),$service)) {
- $RT::Logger->debug("User (",
- $username,
- ") doesn't exist in service (",
- @@ -412,7 +420,8 @@
- ") - Cannot update information - Skipping...");
- next;
- }
- - $user_disabled = RT::Authen::ExternalAuth::LDAP::UserDisabled($username,$service);
- + $RT::Logger->debug("New check on LDAP the username, but removing the special character A from the username.");
- + $user_disabled = RT::Authen::ExternalAuth::LDAP::UserDisabled(substr($username,1),$service);
- } elsif ($config->{'type'} eq 'cookie') {
- RT::Logger->error("You cannot use SSO Cookies as an information service.");
- @@ -429,7 +438,7 @@
- }
- sub CanonicalizeUserInfo {
- -
- + $RT::Logger->debug("Now is starting CanonicalizeUserInfo function");
- # Careful, this $args hashref was given to RT::User::CanonicalizeUserInfo and
- # then transparently passed on to this function. The whole purpose is to update
- # the original hash as whatever passed it to RT::User is expecting to continue its
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement