MoreAboutPrivilegedUsers

From Request Tracker Wiki
Jump to navigation Jump to search

In 3.6.3 there is a block on the ticket display page that shows information about each requestor (new/open tickets, user comments, group membership). This information is only displayed for non-privileged users, though, and in my setup, 99% of the users are privileged.

One simply fix is to edit html/Ticket/Elements/ShowRequestor and take out the little bit that restricts this to non-privileged users, changing this:

next if $requestor->Privileged;

into:

%#next if $requestor->Privileged;

But then any privileged user would see this information. That's not what I wanted, so I created a new Group Right ("ShowMoreAbout") and assigned it to just those users I wanted to have it. In order to create a new group right, edit the file local/lib/RT/Group_Local.pm, adding this code:

use vars qw( $RIGHTS );

$RIGHTS = {
   ShowMoreAbout        => 'Show the "More about <user>" on ticket detail screen.',
   %$RIGHTS
};

foreach my $right ( keys %$RIGHTS ) {
    $RT::ACE::LOWERCASERIGHTNAMES{ lc $right } = $right;
}

(I forget where I picked this code up; it's not on the wiki, that I can see.) If you are creating this file for the first time, don't forget to add this at the top of the file:

package RT::Group;

use strict;
no warnings qw(redefine);

and this at the bottom:

1;

See CleanlyCustomizeRT for more info.

After you've created the right, you can use it in ShowRequestor. Instead of commenting out the line above, change it:

my $has_right_showmore = $session{'CurrentUser'}->HasRight(Object => $RT::System, Right => 'ShowMoreAbout');
next if ((! $has_right_showmore) && ($requestor->Privileged));

Now, all privileged users will see the More About box for non-privileged users, but only people with the ShowMoreAbout right will see the More About box for privileged users.

All of this was done on top of 3.6.3; I have not tested it with any other release. If you find any problems with it, let me know -- JoeCasadonte