Adding ReplyToTicket right to Requestor on Help queue failing

Hi All

I am trying this and I do not the right gets added.

use strict;
use lib ‘/opt/rt3/lib’;

use RT;
use RT::Interface::CLI;
use Data::Dumper;

RT::LoadConfig();
RT::Init();

my $queue = RT::Queue->new( $RT::SystemUser );

my $group = RT::Group->new( $RT::SystemUser );

$queue->Load( ‘Help’ );

$group->LoadSystemRoleGroup( ‘Requestor’ );

$group->PrincipalObj->GrantRight( Object => $queue, Right =>
‘ReplyToTicket’ );

What am I doing wrong?

Asif Iqbal
PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

You don’t check any return value.On Fri, May 31, 2013 at 1:05 AM, Asif Iqbal vadud3@gmail.com wrote:

Hi All

I am trying this and I do not the right gets added.

use strict;
use lib ‘/opt/rt3/lib’;

use RT;
use RT::Interface::CLI;
use Data::Dumper;

RT::LoadConfig();
RT::Init();

my $queue = RT::Queue->new( $RT::SystemUser );

my $group = RT::Group->new( $RT::SystemUser );

$queue->Load( ‘Help’ );

$group->LoadSystemRoleGroup( ‘Requestor’ );

$group->PrincipalObj->GrantRight( Object => $queue, Right =>
‘ReplyToTicket’ );

What am I doing wrong?


Asif Iqbal
PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


RT Training in Seattle, June 19-20: http://bestpractical.com/training

Best regards, Ruslan.

You don’t check any return value.

added the check return and did not disclose any error

if (!$queue->Load( ‘Help’ )) {
die $@;
};

if (!$group->LoadSystemRoleGroup( ‘Requestor’ )){
die $@;
};

if (!$group->PrincipalObj->GrantRight( Object => $queue, Right =>
‘ShowTicket’ )){
die $@;
};

Help Queue Group Rights still not adding Role Requestor with Right
ShowTicket

But then I realized I am using the wrong method.

I changed it to LoadQueueRoleGroup and it is working now.

replaced this

$group->LoadSystemRoleGroup( 'Requestor' );

with this

$group->LoadQueueRoleGroup( Queue => $queue->id, Type => ‘Requestor’ );> On Fri, May 31, 2013 at 1:05 AM, Asif Iqbal vadud3@gmail.com wrote:

Hi All

I am trying this and I do not the right gets added.

use strict;
use lib ‘/opt/rt3/lib’;

use RT;
use RT::Interface::CLI;
use Data::Dumper;

RT::LoadConfig();
RT::Init();

my $queue = RT::Queue->new( $RT::SystemUser );

my $group = RT::Group->new( $RT::SystemUser );

$queue->Load( ‘Help’ );

$group->LoadSystemRoleGroup( ‘Requestor’ );

$group->PrincipalObj->GrantRight( Object => $queue, Right =>
‘ReplyToTicket’ );

What am I doing wrong?


Asif Iqbal
PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


RT Training in Seattle, June 19-20: http://bestpractical.com/training


Best regards, Ruslan.

Asif Iqbal
PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

You still don’t check return value of GrantRight correctly, see examples in
RT.On Fri, May 31, 2013 at 6:20 AM, Asif Iqbal vadud3@gmail.com wrote:

On Thu, May 30, 2013 at 5:51 PM, Ruslan Zakirov ruz@bestpractical.comwrote:

You don’t check any return value.

added the check return and did not disclose any error

if (!$queue->Load( ‘Help’ )) {
die $@;
};

if (!$group->LoadSystemRoleGroup( ‘Requestor’ )){
die $@;
};

if (!$group->PrincipalObj->GrantRight( Object => $queue, Right =>
‘ShowTicket’ )){
die $@;
};

Help Queue Group Rights still not adding Role Requestor with Right
ShowTicket

But then I realized I am using the wrong method.

I changed it to LoadQueueRoleGroup and it is working now.

replaced this

$group->LoadSystemRoleGroup( 'Requestor' );

with this

$group->LoadQueueRoleGroup( Queue => $queue->id, Type => ‘Requestor’ );

On Fri, May 31, 2013 at 1:05 AM, Asif Iqbal vadud3@gmail.com wrote:

Hi All

I am trying this and I do not the right gets added.

use strict;
use lib ‘/opt/rt3/lib’;

use RT;
use RT::Interface::CLI;
use Data::Dumper;

RT::LoadConfig();
RT::Init();

my $queue = RT::Queue->new( $RT::SystemUser );

my $group = RT::Group->new( $RT::SystemUser );

$queue->Load( ‘Help’ );

$group->LoadSystemRoleGroup( ‘Requestor’ );

$group->PrincipalObj->GrantRight( Object => $queue, Right =>
‘ReplyToTicket’ );

What am I doing wrong?


Asif Iqbal
PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


RT Training in Seattle, June 19-20: http://bestpractical.com/training


Best regards, Ruslan.


Asif Iqbal
PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

Best regards, Ruslan.

You still don’t check return value of GrantRight correctly, see examples
in RT.

You don’t check any return value.

added the check return and did not disclose any error

if (!$queue->Load( ‘Help’ )) {
die $@;
};

if (!$group->LoadSystemRoleGroup( ‘Requestor’ )){
die $@;
};

if (!$group->PrincipalObj->GrantRight( Object => $queue, Right =>
‘ShowTicket’ )){
die $@;
};

Help Queue Group Rights still not adding Role Requestor with Right
ShowTicket

But then I realized I am using the wrong method.

I changed it to LoadQueueRoleGroup and it is working now.

replaced this

$group->LoadSystemRoleGroup( 'Requestor' );

with this

$group->LoadQueueRoleGroup( Queue => $queue->id, Type => ‘Requestor’ );

Hi All

I am trying this and I do not the right gets added.

use strict;
use lib ‘/opt/rt3/lib’;

use RT;
use RT::Interface::CLI;
use Data::Dumper;

RT::LoadConfig();
RT::Init();

my $queue = RT::Queue->new( $RT::SystemUser );

my $group = RT::Group->new( $RT::SystemUser );

$queue->Load( ‘Help’ );

$group->LoadSystemRoleGroup( ‘Requestor’ );

$group->PrincipalObj->GrantRight( Object => $queue, Right =>
‘ReplyToTicket’ );

my ( $status, $msg ) = $group->PrincipalObj->GrantRight( Object => $queue,
Right => ‘ShowTicket’ );
print $msg . “\n”;

results

That principal already has that right

doh!

Thanks a lot for your help

What am I doing wrong?


Asif Iqbal
PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


RT Training in Seattle, June 19-20: http://bestpractical.com/training


Best regards, Ruslan.


Asif Iqbal
PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


Best regards, Ruslan.

Asif Iqbal
PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?