[rt-users] How to automatically disable user account

aaronr robinsonaarond at gmail.com
Mon Sep 17 17:54:06 EDT 2012


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();
---------

This script, however, does not work.  I end up with this error:

# ~/bin/rt_disable_user.pl
Can't locate object method "Config" via package "RT" at
/srv/www/rt4/lib/RT/Record.pm line 76.
BEGIN failed--compilation aborted at /srv/www/rt4/lib/RT/Record.pm line 76.
Compilation failed in require at (eval 11) line 2.
	...propagated at /usr/lib/perl5/5.12.3/base.pm line 94.
BEGIN failed--compilation aborted at /srv/www/rt4/lib/RT/User.pm line 70.
Compilation failed in require at ./rt_disable_user line 9.
BEGIN failed--compilation aborted at ./rt_disable_user line 9.

And the user sgeadmin doesn't get disabled.  Once I get the Perl here
working I'll be able to combine the two, but I cannot figure out what is
wrong.  I see other Perl scripts working inside the RT folder that are able
to use RT::User, but I do not seem to be able to do so.

This line does not fail on "use RT::Config", though; that works.  RT::User
seems to load the config, though, and that is where it is hanging up, I
think.

Does anyone have any ideas?

- Aaron
-- 
View this message in context: http://old.nabble.com/How-to-automatically-disable-user-account-tp34229594p34429334.html
Sent from the Request Tracker - User mailing list archive at Nabble.com.




More information about the rt-users mailing list