[rt-users] Assign Global Rights to Group?

Ken Johnson kjohnson at eclypse.org
Thu Jun 13 14:39:02 EDT 2013

On Wed, Jun 12, 2013 at 03:46:29PM -0500, Ken Johnson wrote:
> We find that the best way for us to manage user rights is to create a 
> number of groups, assign global rights to the groups, and then assign 
> users to the appropriate group.
> I'm trying to work out how to assign global rights to a group via a 
> Perl script, but I'm not having much luck.  A simple case might look 
> something like this, I think:
> $group = RT::Group->new( $RT::SystemUser ); 
> $group->LoadUserDefinedGroup( "Group2" ); die "couldn't load group" 
> unless $group->id; print("SelfDescription : " . 
> $group->SelfDescription() . "\n");
> $group->GrantRight(Object => , Right => "CreateTicket");
> This works up to and including the print.  So the problem, of course, 
> is that the GrantRight call is obviously incomplete.  I haven't 
> figured out what the Object should be.

Emmanuel Lacour wrote:


$group->PrincipalObj->GrantRight(Object => $RT::System, Right =>


Thanks!  So this works for me:

# RT perl script
use strict;
use warnings;

use lib "/usr/share/request-tracker4/lib";

use RT;


# The command line looks like this:
# ./grantRightToGroup.pl --rightname=CreateTicket --groupname=bedrock

use RT::Group;
use Getopt::Long;
use RT::Principal;
use RT::System;

my ($rightname, $groupname, $group);
my ($status, $msg);

GetOptions (
"rightname=s" => \$rightname,
"groupname=s" => \$groupname

# Load user defined(public) group

$group = RT::Group->new( $RT::SystemUser );
$group->LoadUserDefinedGroup( $groupname );
die "couldn't load group" unless $group->id;

# Grant a right to a group

($status, $msg) = $group->PrincipalObj->GrantRight(Object => $RT::System,
    Right => $rightname);
die "problem $msg" unless $status;

Ken Johnson

More information about the rt-users mailing list