Hi Kevin.
Mi log file is this:
[Thu Mar 24 16:20:36 2011] [debug]:
RT::Authen::ExternalAuth::CanonicalizeUserInfo called by RT::User
/usr/local/rt-3.8.2_pruebas/lib//RT/User_Vendor.pm 20 with: Disabled: 0,
EmailAddress: , Gecos: pruebas, Name: pruebas, Privileged: 0
(/usr/local/rt-3.8.2_pruebas/lib//RT/Authen/ExternalAuth.pm:450)
[Thu Mar 24 16:20:36 2011] [debug]: Attempting to get user info using
this external service:
(/usr/local/rt-3.8.2_pruebas/lib//RT/Authen/ExternalAuth.pm:458)
[Thu Mar 24 16:20:36 2011] [info]:
RT::Authen::ExternalAuth::CanonicalizeUserInfo returning Disabled: 0,
EmailAddress: , Gecos: pruebas, Name: pruebas, Privileged: 0
(/usr/local/rt-3.8.2_pruebas/lib//RT/Authen/ExternalAuth.pm:536)
[Thu Mar 24 16:20:36 2011] [error]: No puedo crear el usuario pruebas:
Could not set user info (./scripts/crea_user2.pl:39)
Thanks.
El 24/03/2011 16:58, Kevin Falcone escribió:
On Thu, Mar 24, 2011 at 03:20:12PM +0100, Sergio Cubero wrote:
I want create user with perl script, but don't working.
Can you help me?
How doesn't it work?
Please describe the failure and provide the logs.
-kevin
#!/usr/bin/perl
use lib ("/usr/local/rt-3.8.2/lib/");
use RT::Interface::CLI qw(CleanEnv);
use RT;
RT::LoadConfig();
RT::Init();
use RT::Ticket;
use RT::CurrentUser;
use RT::CustomField;
use RT::Action::Generic;
use RT::Transaction;
use MIME::Entity;
package RT::Action::MyAction;
use base qw(RT::Action::Generic);
use RT::Authen::ExternalAuth::LDAP;
use RT::Authen::ExternalAuth::DBI;
my $user = 'username';
my $mail = 'usern...@domain.com';
RT->Config->Get('WebExternalAuto');
$session->{'CurrentUser'} = RT::CurrentUser->new();
$session->{'CurrentUser'}->Load($user);
my $UserObj = RT::User->new($RT::SystemUser);
print $UserObj."\n";
my ($val, $msg) = $UserObj->SetName($user);
my ($val, $msg) =
$UserObj->Create(
%{ref($RT::AutoCreate) ? $RT::AutoCreate : {}},
Name => $user,
Gecos => $user,
_RecordTransaction => 1,
EmailAddress => $mail,
RealName => 'User USer',
Comments => 'user LDAP',
WorkPhone => 'phone,
Address1 => 'streetAddress',
City => 'l',
State => 'st',
Zip => 'postalCode',
Country => 'co'
);
$RT::Logger->info("Autocreated authenticated user " . $UserObj->Name .
" (" . $UserObj->Id . ")\n");
$session{'CurrentUser'}->Load($user) if $UserObj->Id;
$RT::Logger->error( "No puedo crear el usuario $user: $msg" );
if(RT::Authen::ExternalAuth::UserExists($user)){ print "EXISTS";}
else {print "NO EXISTS";}
$RT::Logger->info( "Autocreated external user",
$UserObj->Name,
"(",
$UserObj->Id,
")");
$RT::Logger->debug("Loading new user (",
$username,
") into current session");
$session->{'CurrentUser'}->Load($username);