I am trying to add a user that’s enabled by default. I think the way to
do this is to use SetPrivileged in User_Overlay.pm.
I must be doing something wrong as that’s spewing an error (that
otherwise is not there when I comment that one line out).
Any help would be appreciated.
Code:
my $user_obj = RT::User->new($RT::SystemUser);
my $user = {} ;
bless ($user) ;
my @user = split /","/ ;
substr ($user[0], 0, 1) = “” ;
substr ($user[11], -3) = “” ;
my $old_id = $user[0] ;
$user->{‘Name’} = $user[1] ;
$user->{‘EmailAddress’} = $user[2] ;
$user->{‘EmailAddress’} = $user[0] unless ($user->{‘EmailAddress’}
=~ m/@/ );
$user->{‘WorkPhone’} = “$user[3] $user[4]” ;
$user->{‘MobilePhone’} = $user[5] ;
$user->{‘Comments’} = “$user[10] IMPORTED from F2W” ;
$user->{‘Organization’} = $user[11];
$user->{‘SetPrivileged’} = ‘0’ ;
my ($uid, $umsg) = $user_obj->Create( %{$user} );
my $id = $user_obj->Id();
$user_map->{$old_id} = $id;
Error:
[Tue Feb 18 22:37:41 2003] [warning]: DBD::mysql::st execute failed:
Unknown column ‘SetPrivileged’ in ‘field list’ at
/usr/lib/perl5/site_perl/5.8.0/DBIx/SearchBuilder/Handle.pm line 376,
line 1.
(/usr/local/rt-3.0/lib/RT.pm:220)
[Tue Feb 18 22:37:41 2003] [warning]: RT::Handle=HASH(0x8cab800)
couldn’t execute the query ‘INSERT INTO Users (Comments, EmailAddress,
Creator, LastUpdatedBy, Password, MobilePhone, WorkPhone, Created, id,
Name, Organization, SetPrivileged, LastUpdated) VALUES (?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?)’ at
/usr/lib/perl5/site_perl/5.8.0/DBIx/SearchBuilder/Handle.pm line 383,
line 1.
(/usr/local/rt-3.0/lib/RT.pm:220)
[Tue Feb 18 22:37:41 2003] [error]: Could not create a new user
(/usr/local/rt-3.0/lib/RT/User_Overlay.pm:218)
[Tue Feb 18 22:37:41 2003] [warning]: DBD::mysql::st execute failed:
Unknown column ‘SetPrivileged’ in ‘field list’ at
/usr/lib/perl5/site_perl/5.8.0/DBIx/SearchBuilder/Handle.pm line 376,
line 2.