Import user enabled by default

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.

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 was looking over some stuff in the contrib section and noticed that
Privileged was used to enable users in another script.

I think I may have found a bug in the docs - although for now I’ll
assume the error is mine. The text below is taken from perldoc
User_Overlay.pm.

The way I read it SetPrivileged is a bool that changes membership of the
pseudogroup, while privileged is a check only.

I’m running RT-2-1-72.

From User_Overlay:

SetPrivileged BOOL

If passed a true value, makes this user a member of the “Privileged”
PseudoGroup. Otherwise, makes this user a member of the “Unprivileged”
pseudogroup.

Returns a standard RT tuple of (val, msg);

Privileged

Returns true if this user is privileged. Returns undef otherwise.

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 was looking over some stuff in the contrib section and noticed that
Privileged was used to enable users in another script.

After trying both Privileged and SetPrivileged I realized that I’m in
the wrong area. I need to be creating users that are not disabled… I
still don’t see the users being granted the rights as I would expect,
but perhaps that’s because they are still disabled.

Any hints on how to create a user that’s enabled by default? I think I
need to set an ACL separately but am not sure what method to call.
Bacially I want to statically set all the users I import to Enabled,
able to create tickets, and able to add comments.

Somebody, please at least tell me to go back to the rt-users list - at
this point I’m ready for it.

Thanks
Matt