[rt-users] How to automatically disable user account
Tim Cutts
tjrc at sanger.ac.uk
Tue Sep 18 09:27:44 EDT 2012
On 17 Sep 2012, at 22:54, aaronr <robinsonaarond at gmail.com> 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.
More information about the rt-users
mailing list