[rt-users] API $user->create problems
Emmanuel Lacour
elacour at easter-eggs.com
Fri Jan 25 17:11:29 EST 2008
On Thu, Jan 24, 2008 at 03:29:16PM +0100, Krieg, Alexander wrote:
> Hi,
>
> i just created a script to add existing users to existing groups, that
> works fine.
> I also can create queues, groups and set rights for all of them.
>
> But i cannot create a simple user and find him than over the web-gui, i
> think it cannot be so hard, but i do not see my mistake.
> here the code i use, and i do not get any error messages or warnings.
>
> use lib ("/opt/rt3/local/lib", "/opt/rt3/lib", "/opt/rt3/etc/");
> use warnings;
>
> use RT::User;
> use RT::Group;
> use Getopt::Long;
> use RT::Interface::CLI qw(CleanEnv GetCurrentUser GetMessageContent loc);
>
> CleanEnv();
> RT::LoadConfig();
> RT::Init();
>
> my $user = RT::User->new($RT::SystemUser);
> $user->Create(Name => 'foo',
> EmailAddress => 'foo.foo at foo.de',
> Privileged => 1,
> Password => 'foo',
> RealName => 'foo test');
>
> i think it should work !?
>
It looks ok to me (I use some similar code in my scripts), try to catch an error:
my ($code, $msg) = $user->Create ...
if ( ! $code )
{
print STDERR "Error creating user: $msg\n";
}
More information about the rt-users
mailing list