AdminClass right and RT-FM

I’m in the process of deploying RT-FM, and I have come across a
strangeness with access to classes in order to configure them. We
have an rt-admin group, to which I have given the AdminClass right
globally.

However, when I go to the configure page for the classes, I (a member
of the rt-admin group) can only see one of the two classes that I have
created, and I don’t understand why.

I tried to create a small perl script to examine the rights directly:

#!/usr/bin/perl -w

use strict;

use lib qw’/opt/rt3/lib /opt/rt3/local/lib’;

use RT;
use RT::Interface::CLI qw/GetCurrentUser/;

RT::LoadConfig;
RT::Init;

my $user = GetCurrentUser();

my $c = RT::FM::Class->new($user);

$c->Load(‘someclassname’);

if ($user->HasRight(Right => ‘AdminClass’,
Object => $c)) {
print “Yes we can\n”;
}

but I’m not sure I’ve done this right, because it dies with:

Can’t locate object method “new” via package “RT::FM::Class” (perhaps
you forgot to load “RT::FM::Class”?) at test.pl line 15, line
273.

I’ve definitely got RT::FM in the @Plugins variable, so does anyone
have any clues as to (a) what I might have done wrong with the rights
in general and (b) why my little test script above does not work?

Thanks in advance,

Tim

The Wellcome Trust Sanger Institute is operated by Genome Research
Limited, a charity registered in England with number 1021457 and a
company registered in England with number 2742969, whose registered
office is 215 Euston Road, London, NW1 2BE.

I’m in the process of deploying RT-FM, and I have come across a
strangeness with access to classes in order to configure them. We
have an rt-admin group, to which I have given the AdminClass right
globally.

However, when I go to the configure page for the classes, I (a member
of the rt-admin group) can only see one of the two classes that I have
created, and I don’t understand why.

There is also a SeeClass right you might want to grant.

I tried to create a small perl script to examine the rights directly:

#!/usr/bin/perl -w

use strict;

use lib qw’/opt/rt3/lib /opt/rt3/local/lib’;

use RT;
use RT::Interface::CLI qw/GetCurrentUser/;

RT::LoadConfig;
RT::Init;

my $user = GetCurrentUser();

my $c = RT::FM::Class->new($user);

$c->Load(‘someclassname’);

if ($user->HasRight(Right => ‘AdminClass’,
Object => $c)) {
print “Yes we can\n”;
}

but I’m not sure I’ve done this right, because it dies with:

Can’t locate object method “new” via package “RT::FM::Class” (perhaps
you forgot to load “RT::FM::Class”?) at test.pl line 15, line
273.

you need to use RT::FM::Class; before you call new on it

-kevin

I’m in the process of deploying RT-FM, and I have come across a
strangeness with access to classes in order to configure them. We
have an rt-admin group, to which I have given the AdminClass right
globally.

However, when I go to the configure page for the classes, I (a member
of the rt-admin group) can only see one of the two classes that I
have
created, and I don’t understand why.

There is also a SeeClass right you might want to grant.

Yep, done that (AdminClass is the crucial one, judging by RT-FM/html/
Admin/RTFM/Classes/index.html)

I tried to create a small perl script to examine the rights directly:

#!/usr/bin/perl -w

use strict;

use lib qw’/opt/rt3/lib /opt/rt3/local/lib’;

use RT;
use RT::Interface::CLI qw/GetCurrentUser/;

RT::LoadConfig;
RT::Init;

my $user = GetCurrentUser();

my $c = RT::FM::Class->new($user);

$c->Load(‘someclassname’);

if ($user->HasRight(Right => ‘AdminClass’,
Object => $c)) {
print “Yes we can\n”;
}

but I’m not sure I’ve done this right, because it dies with:

Can’t locate object method “new” via package “RT::FM::Class” (perhaps
you forgot to load “RT::FM::Class”?) at test.pl line 15, line
273.

you need to use RT::FM::Class; before you call new on it

Actually, it seems to be require that’s needed but not use. Thanks
for the hint.

It’s a bit inconsistent with searching for RT core objects.
If it were a ticket I was looking for, I wouldn’t need to “require
RT::Ticket”:

Anyway, that aside, my script now works, and it shows that my user
indeed does not seem to have rights to access that class, but I don’t
understand why, given that the user is a member of the rt-admin
group, and the rt-admin group does have that right.

Workaround: If I configure the right at the per-Class level, it works
fine. It seems that it’s only the global right that doesn’t seem to
work. Should I file a bug report?

Tim

The Wellcome Trust Sanger Institute is operated by Genome Research
Limited, a charity registered in England with number 1021457 and a
company registered in England with number 2742969, whose registered
office is 215 Euston Road, London, NW1 2BE.

I’m in the process of deploying RT-FM, and I have come across a
strangeness with access to classes in order to configure them. We
have an rt-admin group, to which I have given the AdminClass right
globally.

However, when I go to the configure page for the classes, I (a
member
of the rt-admin group) can only see one of the two classes that I
have
created, and I don’t understand why.

There is also a SeeClass right you might want to grant.

Yep, done that (AdminClass is the crucial one, judging by RT-FM/html/
Admin/RTFM/Classes/index.html)

I tried to create a small perl script to examine the rights
directly:

#!/usr/bin/perl -w

use strict;

use lib qw’/opt/rt3/lib /opt/rt3/local/lib’;

use RT;
use RT::Interface::CLI qw/GetCurrentUser/;

RT::LoadConfig;
RT::Init;

my $user = GetCurrentUser();

my $c = RT::FM::Class->new($user);

$c->Load(‘someclassname’);

if ($user->HasRight(Right => ‘AdminClass’,
Object => $c)) {
print “Yes we can\n”;
}

but I’m not sure I’ve done this right, because it dies with:

Can’t locate object method “new” via package
"RT::FM::Class" (perhaps
you forgot to load “RT::FM::Class”?) at test.pl line 15, line
273.

you need to use RT::FM::Class; before you call new on it

Actually, it seems to be require that’s needed but not use. Thanks
for the hint.

It’s a bit inconsistent with searching for RT core objects.
If it were a ticket I was looking for, I wouldn’t need to “require
RT::Ticket”:

Anyway, that aside, my script now works, and it shows that my user
indeed does not seem to have rights to access that class, but I
don’t understand why, given that the user is a member of the rt-
admin group, and the rt-admin group does have that right.

Workaround: If I configure the right at the per-Class level, it
works fine. It seems that it’s only the global right that doesn’t
seem to work. Should I file a bug report?

Sure, send something to rtfm-bugs@bestpractical.com

-kevin

It’s a bit inconsistent with searching for RT core objects.
If it were a ticket I was looking for, I wouldn’t need to “require
RT::Ticket”:

RT loads all core objects in RT::InitClasses
RTFM is a plugin and doesn’t do that, so you need to bring in classes
you
want to use

-kevin

It’s a bit inconsistent with searching for RT core objects.
If it were a ticket I was looking for, I wouldn’t need to “require
RT::Ticket”:

RT loads all core objects in RT::InitClasses
RTFM is a plugin and doesn’t do that, so you need to bring in classes
you
want to use

Makes sense. Doing it in InitPlugins would probably be a bit too
expensive if the number of plugins is large.

Thanks for your help. There will be an rtfm-bugs mail incoming shortly.

Tim

The Wellcome Trust Sanger Institute is operated by Genome Research
Limited, a charity registered in England with number 1021457 and a
company registered in England with number 2742969, whose registered
office is 215 Euston Road, London, NW1 2BE.

I tried to create a small perl script to examine the rights directly:

#!/usr/bin/perl -w

use strict;

use lib qw’/opt/rt3/lib /opt/rt3/local/lib’;

use RT;
use RT::Interface::CLI qw/GetCurrentUser/;

RT::LoadConfig;
RT::Init;

my $user = GetCurrentUser();

my $c = RT::FM::Class->new($user);

$c->Load(‘someclassname’);

if ($user->HasRight(Right => ‘AdminClass’,
Object => $c)) {
print “Yes we can\n”;
}

but I’m not sure I’ve done this right, because it dies with:

Can’t locate object method “new” via package “RT::FM::Class” (perhaps
you forgot to load “RT::FM::Class”?) at test.pl line 15, line
273.

RT::FM doesn’t pre-load all its classes at startup. so adding:

require RT::FM::Class;

right before your ->new statement will probably help

note that a ‘use’ may fail because use is compile-time evaluated…and
that may happen before plugins are innited.

-j