[rt-users] CLI: manipulating "privileged" status
Torsten Brumm
torsten.brumm at googlemail.com
Tue Aug 22 06:05:36 EDT 2006
Try the following sniplet:
#!/usr/bin/perl
use strict;
use warnings;
BEGIN { die "You must define \$RT_HOME\n"
unless exists $ENV{RT_HOME} };
use lib "$ENV{RT_HOME}/lib";
use RT;
RT::LoadConfig();
RT::Init();
use RT::Interface::CLI qw(GetCurrentUser loc);
use RT::Tickets;
my $CurrentUser = GetCurrentUser();
die loc("No RT user found.\n") unless ($CurrentUser->Id);
die "We need exactly 2 Arguments, Name & Email\n" unless ($#ARGV==1);
my $UserName=shift @ARGV;
my $Email=shift @ARGV;
my $User = RT::User->new($CurrentUser);
my
($id,$Message)=$User->Create(Name=>$UserName,EmailAddress=>$Email,Privileged=>1,Password=>'changeme');
if ($id){
print $Message."\n";
}
else{
print"This is a error!\n$Message\n";
}
2006/8/21, Ole Craig <ocraig at stillsecure.com>:
>
>
> Is the long-standing bug with the CLI and groups fixed in 3.6.1? I'm
> planning to upgrade from 3.6.0 anyhow; if this is fixed I'll reprioritize
> the upgrade.
>
> If not, is there any way (from the command line) to manipulate a user's
> "privileged" status? I have a metric buttload of users to enable, and I have
> no wish to click through each one successively just to change one freakin'
> checkbox.
>
> If I'm being stupid (certainly wouldn't be the first time) and there's an
> easy way to do this without using the bin/rt tool, please feel free to
> ridicule me while you point out the answer. I would've tried it directly in
> MySQL, but the Privileged pseudogroup is nameless. :-(
>
> Thanks,
> Ole
>
> PS. I say "long-standing" because after extensive Googling and archive
> spelunking, I've found the same question popping up several times but it's
> never answered (at least, not on-list.) In 3.6.0 I get "# Unknown object
> type: group" from any attempt to show, list, edit, or create a group using
> the rt commandline tool, despite the verbiage in both the tool itself and in
> RT Essentials. This seems to have been a problem since at least 3.4.4.
>
>
>
>
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com
>
>
--
MFG
Torsten Brumm
http://www.torsten-brumm.de
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20060822/c807616e/attachment.htm>
More information about the rt-users
mailing list