Modifying the QuickCalls extension to limit access by group

Hi All

We’re playing around with RT4, relearning how it all works. Chap I work with has tweaked the RT::Extension:: QuickCalls to allow restriction by group membership i.e you only see the call option if you are a member of a certain group. The modified Quickcalls element (/your_path_to/rt4/local/plugins/RT-Extension-QuickCalls/html/Elements/QuickCalls) is here:

<&| /Widgets/TitleBox, title => loc(‘Quick Calls’) &>
<form action="<%$RT::WebPath%>/Helpers/QuickCalls">
<select name=“QuickCall”>
% foreach my $QuickCall (@{$RT::QuickCalls||[]}) {
% if($QuickCall->{‘Groups’}) {
% my $allow = 0;
% my $groupObj = new RT::Group;
% my $principalId = $session{CurrentUser}->Id;
% foreach my $groupName (@{$QuickCall->{‘Groups’}}) {
% $groupObj->LoadUserDefinedGroup($groupName);
% if($groupObj->HasMemberRecursively($principalId)) {
% $allow = 1;
% last;
% }
% }
% next if(!$allow);
% }
<option value="<%$QuickCall->{Name}%>"><%$QuickCall->{Name}%>
% }
</select>
<input type=“submit” value=“Create”>
</form>
</&>

and the SiteConfig setup is below. In this setup everyone sees “Foo” & “Bar”, but only members of the networks Group see “restricted Quick Call” :

Set($QuickCalls,[ {
Name => ‘Restricted QuickCall’,
Queue => ‘Middleware and Library Systems’,
Groups => [ ‘Networks’ ],
Status => ‘resolved’
},
{
Name => “Foo”,
Queue => ‘Service Desk’,
Status => ‘resolved’
},
{
Name => “Bar”,
Queue => ‘Networks and Pork Scratchings’,
Status => ‘resolved’
}
]);

We hope this is of use to some of you

regards
Garry

1 Like