Thank you! That is exactly what I was missing. I tried looking through some other Perl scripts already in the folder to see what to "use," but hadn't run across those. I figured it would tell me, too, if it needed anything else sourced. At any rate, that fixed the problem.
One other thing, it turns out that $user->SetDisabled(); doesn't actually work, as it needs a variable. SetDisabled(1) will disable account, while SetDisabled(0) will actually re-enable the account. Threw me off at first, but I'm good now. Thanks again for the help! - Aaron On Tue, Sep 18, 2012 at 7:27 AM, Tim Cutts <[email protected]> wrote: > > On 17 Sep 2012, at 22:54, aaronr <[email protected]> wrote: > > > > > I am looking for this same information. > > > > I found this program from a few years ago, which is supposed to disable a > > user: > > > > --------- > > #! /usr/bin/perl -w > > > > use lib '/srv/www/rt4/lib'; > > > > > > use RT::Base; > > use RT::Config; > > use RT::User; > > > > > > my $UserId = "sgeadmin"; > > my $user = RT::User->new($RT::SystemUser); > > $user->Load($UserId); > > $user->SetDisabled(); > > --------- > > It's missing some preamble needed to initialise the RT perl API. > Something like this: > > #! /usr/bin/perl -w > > use lib '/srv/www/rt4/lib'; > > use RT; > use RT::User; > > RT::LoadConfig; > RT::Init; > > my $UserId = "sgeadmin"; > my $user = RT::User->new($RT::SystemUser); > $user->Load($UserId); > $user->SetDisabled(); > > Should work. > > Tim > > -- > The Wellcome Trust Sanger Institute is operated by Genome Research > Limited, a charity registered in England with number 1021457 and a > company registered in England with number 2742969, whose registered > office is 215 Euston Road, London, NW1 2BE. >
-------- Final RT training for 2012 in Atlanta, GA - October 23 & 24 http://bestpractical.com/training We're hiring! http://bestpractical.com/jobs
