We have a need to hide (ideally) certain standard RT fields
from privileged users.
I don’t see that this is possible with the standard rights
controls.
Is that accurate?
We have a need to hide (ideally) certain standard RT fields
from privileged users.
I don’t see that this is possible with the standard rights
controls.
Is that accurate?
If you like to a clean version try something like this:
our $VERSION = ‘0.01’;
use warnings;
use strict;
use RT::System;
my %rights = (
ViewSomeMenuItems => ‘View some Menu Items’, #loc_pair
);
$RT::System::RIGHTS = { %$RT::System::RIGHTS, %rights };
%RT::ACE::LOWERCASERIGHTNAMES = ( %RT::ACE::LOWERCASERIGHTNAMES,
map { lc($) => $ } keys %rights);
1;
Inside the module you like to check do something like this:
% if ( $Ticket->CurrentUserHasRight(‘ViewSomeMenuItems’) ) {
% }
Example: from EditBasics (share/html/Ticket/Elements/EditBasics)
moved to local/html/Ticket/Elements/EditBasics or better create a
“real” RT Modul with this…
% if ( $Ticket->CurrentUserHasRight(‘ViewSomeMenuItems’) ) {
}% $m->callback( CallbackName => ‘EndOfList’, TicketObj => $TicketObj, %ARGS );
<&|/l&>Subject: | |
<&|/l&>Status: | <%$SelectStatus|n%> |
<&|/l&>Queue: | <%$SelectQueue|n%> |
<&|/l&>Owner: | <& /Elements/SelectOwner, Name => 'Owner', QueueObj => $TicketObj->QueueObj, TicketObj => $TicketObj, Default => $TicketObj->OwnerObj->Id, DefaultValue => 0, &> |
<&|/l&>Time Estimated: | <& /Elements/EditTimeValue, Name => 'TimeEstimated', Default => $TicketObj->TimeEstimated, &> |
<&|/l&>Time Worked: | <& /Elements/EditTimeValue, Name => 'TimeWorked', Default => $TicketObj->TimeWorked, &> |
<&|/l&>Time Left: | <& /Elements/EditTimeValue, Name => 'TimeLeft', Default => $TicketObj->TimeLeft, &> |
<&|/l&>Priority: | <& /Elements/SelectPriority, Default => $TicketObj->Priority, &> |
<&|/l&>Final Priority: | <& /Elements/SelectPriority, Name => "FinalPriority", Default => $TicketObj->FinalPriority, &> |
<%INIT>
#It’s hard to do this inline, so we’ll preload the html of the
selectstatus in here.
my $SelectStatus = $m->scomp(“/Elements/SelectStatus”, Name =>
‘Status’, DefaultLabel => loc(“[_1]
(Unchanged)”,loc($TicketObj->Status)));
my $SelectQueue = $m->scomp(“/Elements/SelectQueue”, Name => ‘Queue’,
Default =>$TicketObj->QueueObj->Id, ShowNullOption => 0);
</%INIT>
<%ARGS>
$TicketObj => undef
</%ARGS>
another, less complex but performance suboptimal version you can find
on the wiki: GroupMembershipCheck - Request Tracker Wiki
Let’s assume again you like to change the EditBasics file:
% my $GroupObj = RT::Group->new( $session{ ‘CurrentUser’ } );
% my $PrincipalObj = RT::Principal->new( $session{ ‘CurrentUser’ } );
% $PrincipalObj->Load( $session{ ‘CurrentUser’ }->id );
% $GroupObj->LoadUserDefinedGroup(
‘NameOfTheGroupYouLikeToGrantAccessToTheMenuItem’ );
% my $HasMember = $GroupObj->HasMemberRecursively( $PrincipalObj );
% if ( $HasMember ) {
}% $m->callback( CallbackName => ‘EndOfList’, TicketObj => $TicketObj, %ARGS );
<&|/l&>Subject: | |
<&|/l&>Status: | <%$SelectStatus|n%> |
<&|/l&>Queue: | <%$SelectQueue|n%> |
<&|/l&>Owner: | <& /Elements/SelectOwner, Name => 'Owner', QueueObj => $TicketObj->QueueObj, TicketObj => $TicketObj, Default => $TicketObj->OwnerObj->Id, DefaultValue => 0, &> |
<&|/l&>Time Estimated: | <& /Elements/EditTimeValue, Name => 'TimeEstimated', Default => $TicketObj->TimeEstimated, &> |
<&|/l&>Time Worked: | <& /Elements/EditTimeValue, Name => 'TimeWorked', Default => $TicketObj->TimeWorked, &> |
<&|/l&>Time Left: | <& /Elements/EditTimeValue, Name => 'TimeLeft', Default => $TicketObj->TimeLeft, &> |
<&|/l&>Priority: | <& /Elements/SelectPriority, Default => $TicketObj->Priority, &> |
<&|/l&>Final Priority: | <& /Elements/SelectPriority, Name => "FinalPriority", Default => $TicketObj->FinalPriority, &> |
<%INIT>
#It’s hard to do this inline, so we’ll preload the html of the
selectstatus in here.
my $SelectStatus = $m->scomp(“/Elements/SelectStatus”, Name =>
‘Status’, DefaultLabel => loc(“[_1]
(Unchanged)”,loc($TicketObj->Status)));
my $SelectQueue = $m->scomp(“/Elements/SelectQueue”, Name => ‘Queue’,
Default =>$TicketObj->QueueObj->Id, ShowNullOption => 0);
</%INIT>
<%ARGS>
$TicketObj => undef
</%ARGS>2010/3/31 Jeff Blaine jblaine@kickflop.net:
We have a need to hide (ideally) certain standard RT fields
from privileged users.I don’t see that this is possible with the standard rights
controls.Is that accurate?
Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com
MFG
Torsten Brumm
Hi Torsten,On Thu, Apr 1, 2010 at 5:55 AM, Torsten Brumm torsten.brumm@googlemail.com wrote:
If you like to a clean version try something like this:
- MyTineRightsAddOn.pm
package RT::Extension::MyTinyRightsAddOn;
our $VERSION = ‘0.01’;
use warnings;
use strict;use RT::System;
my %rights = (
ViewSomeMenuItems => ‘View some Menu Items’, #loc_pair
);
$RT::System::RIGHTS = { %$RT::System::RIGHTS, %rights };
%RT::ACE::LOWERCASERIGHTNAMES = ( %RT::ACE::LOWERCASERIGHTNAMES,
map { lc($) => $ } keys %rights);1;
I have followed your tip but I could not see how to add this rights to
a User, for example (through Configuration > Globals > User Rights).
How can I do this? (if I can…)
Thank you for any help!
Saudações,
Italo Valcy :: http://wiki.dcc.ufba.br/~ItaloValcy