How to disable user account in rt via script

Hi all,

I am trying to write a perl script to disable rt user account, so the
script should perform a task similar to unchecking the checkbox “Let
User Access RT” in the rt web ui. Can you please advise me what is the
best way to do so , or if there is a perl module that has some functions
to do that?

Thanks,
Noura

Hi Noura,

There is a method in RT::User called SetDisabled that will probably do what
you want. Try loading the user you want to disable into a user object and
then call the method like this:

my $UserId = #### user id of the user you want to disable #####
my $user = RT::User->new($RT::SystemUser);
$user->Load($UserId);
$user->SetDisabled();

I don’t know what might happen if you do this to the current user (the
person logged in to RT).

Good luck,
Gene

At 07:22 PM 10/28/2007, Noura Elhawary wrote:

Hi all,

I am trying to write a perl script to disable rt user account, so the
script should perform a task similar to unchecking the checkbox “Let
User Access RT” in the rt web ui. Can you please advise me what is the
best way to do so , or if there is a perl module that has some functions
to do that?

Thanks,
Noura


The rt-users Archives

SAVE THOUSANDS OF DOLLARS ON RT SUPPORT:

If you sign up for a new RT support contract before December 31, we’ll take
up to 20 percent off the price. This sale won’t last long, so get in touch
today.
Email us at sales@bestpractical.com or call us at +1 617 812 0745.

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Gene LeDuc, GSEC
Security Analyst
San Diego State University