[rt-devel] Feature for 2.0.15: The Configuration menu is only displayed if the user has rights.
Warnke Andreas
Andreas.Warnke at 3SOFT.de
Thu Nov 21 09:59:21 EST 2002
Hi Folks,
If you want the [Configuration]-Link be displayed only when the user has
Configuration-Rights,
Change the <%INIT> Section of webrt/Elements/Tabs to:
<%INIT>
my ($tab, $action);
my $toptabs = { A => { title => 'Home',
path => '',
},
B => { title => 'Search',
path => 'Search/Listing.html'
},
D => { title => 'Configuration',
path => 'Admin/'
}
};
# ----------------------------------------
# added by andreas.warnke @3Soft.de
# ----------------------------------------
# check, if the user has config-rights:
my $ConfigAccess = undef;
use RT::Queues;
# check global rights:
my $user = $session{'CurrentUser'};
if ( $user->HasSystemRight('AdminGroups') ||
$user->HasSystemRight('AdminKeywordSelects') ||
$user->HasSystemRight('AdminKeywords') ||
$user->HasSystemRight('AdminQueue') ||
$user->HasSystemRight('AdminUsers') ||
$user->HasSystemRight('ModifyACL') ||
$user->HasSystemRight('ModifyQueueWatchers') ||
$user->HasSystemRight('ModifyScrips') ||
# $user->HasSystemRight('ModifySelf') ||
$user->HasSystemRight('ModifyTemplate') ||
$user->HasSystemRight('ShowACL') ||
$user->HasSystemRight('ShowScrips') ||
$user->HasSystemRight('ShowTemplate') ||
$user->HasSystemRight('SuperUser') ) {
$ConfigAccess = 1; }
# check queue rights:
my $queues = new RT::Queues( $user );
while ( my $queue = $queues->Next() )
{
if ( $queue->CurrentUserHasRight('AdminKeywordSelects') ||
$queue->CurrentUserHasRight('AdminQueue') ||
$queue->CurrentUserHasRight('ModifyACL') ||
$queue->CurrentUserHasRight('ModifyQueueWatchers') ||
$queue->CurrentUserHasRight('ModifyScrips') ||
$queue->CurrentUserHasRight('ModifyTemplate') ||
$queue->CurrentUserHasRight('ShowACL') ||
$queue->CurrentUserHasRight('ShowScrips') ||
$queue->CurrentUserHasRight('ShowTemplate') ) {
$ConfigAccess = 1; }
}
# if no access, delete options from toptabs:
unless ( $ConfigAccess ) {
delete $toptabs->{'D'};
if ($current_toptab eq 'Admin/' ) {
$tabs=undef;
$subtabs=undef;
}
}
# ----------------------------------------
my $topactions = {
A => { html => $m->scomp('/Elements/CreateTicket')
},
B => { html => $m->scomp('/Elements/GotoTicket')
}
};
</%INIT>
Comment:
This is a simple workaround. A complete solution would require to check
all $tab-options and $subtab options if the user has access to them.
Greetings
Andreas
More information about the Rt-devel
mailing list