I am trying to find the sql query to disable all privileged accounts that do not have an email address on record and also un-privilege them while at it. Can someone please help?
How about a little Perl script? Something along the lines of:
#!/usr/bin/perl
use strict;
use lib '/opt/rt4/lib';
use RT -init;
use RT::User;
use RT::Users;
my $currentUser = RT::CurrentUser->new(RT::SystemUser);
my $Users = new RT::Users($currentUser);
$Users->LimitToPrivileged();
while(my $thisUser = $Users->Next) {
next if($thisUser->EmailAddress ne '');
next if($thisUser->Disabled);
print $thisUser->Name . "\n";
$thisUser->SetDisabled;
$thisUser->SetPrivileged(0);
}
You’ll probably want to make a backup of your database before running this of course (Just In Case™).