Greetings RT Users
I am new to RT and have recently upgraded a 4.4.4 system left behind by my predecessor to 5.0.0 with minimal issues.
I am attempting to view an asset using the SelfService portal with an unprivileged user. I have changed “view asset”, “view catalogue”, and “view custom field values” into just about every possible combination through groups and roles.
Below is the error I get with every attempt:
[7541] [Tue Sep 29 17:48:21 2020] [error]: Can’t locate object method “child” via package “Menu” (perhaps you forgot to load “Menu”?) at /opt/rt5/sbin/…/lib/RT/Interface/Web/MenuBuilder.pm line 1642.
If I elevate the user to privileged, they are able to see the asset as expected but they are also able to see users and groups outside their own and this is not acceptable.
I am hoping that someone here has either run into this issue or has an idea of what I might need to do.
I am fine with the elevated permissions and interface, if I can disable the user/group view/search abilities.
This is an upgrade from an rt4 instance. I haven’t had any problems with it other than this singular error and it wasn’t a gating item so I moved past, hoping to find a solution once I rounded back to that point.
So my first thought is, maybe upgrade to 5.0.2 since there are some bug fixes in the newer version. But the code that is resulting in the error doesn’t point to any obvious issues to me
Just a thought, but could you make a local copy of /opt/rt5/lib/RT/Interface/Web/MenuBuilder.pm into /opt/rt5/local/lib/RT/Interface/Web/MenuBuilder.pm and then in the local copy add the line:
use RT::Interface::Web::Menu;
under the use warnings; line. Then clear the Mason cache, give the web server a restart and see if that fixes things for you.
Just a thought, but could you make a local copy of /opt/rt5/lib/RT/Interface/Web/MenuBuilder.pm into /opt/rt5/local/lib/RT/Interface/Web/MenuBuilder.pm and then in the local copy add the line:
use RT::Interface::Web::Menu;
under the use warnings; line. Then clear the Mason cache, give the web server a restart and see if that fixes things for you.
Unfortunately, no success. I tried ALL the above, but the error did not disappear or change…
What makes me wonder is the sbin part in the path of the file /opt/rt5/sbin/…/lib/RTInterface/Web/MenuBuilder.pm (please check 1rst message of ImDaShoe)
Might all the problem arise from neglecting the run of etc/upgrade/upgrade-assets utility??
OK, I’ve had a bit of a read of the code, and I’m not sure what the intention of
if (Menu->child("new")) {
my $actions = $page->child("actions", title => loc("Actions"));
$actions->child("create-linked-ticket", title => loc("Create linked ticket"), path => "/SelfService/Asset/CreateLinkedTicket.html?Asset=$id");
}
is supposed to be. I think its trying to make an Actions menu with a “Create linked ticket” action appear based on a condition, but the condition doesn’t seem to make sense. So, how about either:
a) commenting all four lines above out in your local copy of the code if you don’t need to create linked tickets
OR
b) comment out the outer two conditional lines from around the inner two lines so that you always get the create linked tickets action appear.
At least either of those should stop the error appearing (and you can probably get rid of the use line I suggested above too).
Actually digging a bit deeper into Best Practical’s github, it looks like that if(Menu->child("new")) { is a hang over from when the menu building logic was lifted out of share/html/Elements/Tabs and put into its own module. If you look at commit 755042f6a9941734e21a987a638ff03b36b4dc18 you can see the old code with those lines towards the end of the removed code.
Now looking up a back a bit from the problem lines in that commit, we can see:
if ( $queue_count > 1 ) {
 Menu->child( new => title => loc('New ticket'), path => '/SelfService/CreateTicketInQueue.html' );
 } elsif ( $queue_id ) {
 Menu->child( new => title => loc('New ticket'), path => '/SelfService/Create.html?Queue=' . $queue_id );
 }
Now in 5.0.0’s lib/RT/Interface/Web/MenuBuilder.pm the equivalent lines to those are:
if ( $queue_count > 1 ) {
$home->child( new => title => loc('Create Ticket'), path => '/SelfService/CreateTicketInQueue.html' );
} elsif ( $queue_id ) {
$home->child( new => title => loc('Create Ticket'), path => '/SelfService/Create.html?Queue=' . $queue_id );
}
So what I’m now wondering is if the naughty broken code in lib/RT/Interface/Web/MenuBuilder.pm should actually read:
if ($home->child("new")) {
my $actions = $page->child("actions", title => loc("Actions"));
$actions->child("create-linked-ticket", title => loc("Create linked ticket"), path => "/SelfService/Asset/CreateLinkedTicket.html?Asset=$id");
}
Not sure, and we don’t use assets here, so this is an “exercise for the reader” (as my maths master used to like to say when we reached a sticky bit in a calculation!).
Hey @GreenJimll thank you very much!
Both your replies lead to a solution regarding the display of Asset details!
However… the “Create Linked Ticket” button does not yet appear in any of your solutions…
It remains a problem to solve…
(Let me say that I already have checked the rights: ShowAsset, ShowAssetsMenu, ModifyAsset, ShowCatalog, CreateTicket, more for the Requestor/User)