https://rt-wiki.bestpractical.com/index.php?title=LoopIn&feed=atom&action=history
LoopIn - Revision history
2024-03-29T09:20:46Z
Revision history for this page on the wiki
MediaWiki 1.37.2
https://rt-wiki.bestpractical.com/index.php?title=LoopIn&diff=26350&oldid=prev
Tharn at 00:54, 14 August 2016
2016-08-14T00:54:42Z
<p></p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 20:54, 13 August 2016</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l9">Line 9:</td>
<td colspan="2" class="diff-lineno">Line 9:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>*Cc and AdminCc addresses</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>*Cc and AdminCc addresses</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Additionally, there is a lookaside file with rules to permit addresses to loop in others within a specific domain. The permitted list can include specific authorized addresses or anyone at a domain.</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Additionally, there is a lookaside file with rules to permit addresses to loop in others within a specific domain. The permitted list can include specific authorized addresses or anyone at a domain.</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>==RT::Action::LoopIn Module==</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"> </del>package RT::Action::LoopIn;</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">=</ins>== RT::Action::LoopIn Module ==<ins style="font-weight: bold; text-decoration: none;">=</ins></div></td></tr>
<tr><td colspan="2" class="diff-side-deleted"></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"><pre> </ins></div></td></tr>
<tr><td colspan="2" class="diff-side-deleted"></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>package RT::Action::LoopIn;</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> </div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> # SEE: http://wiki.bestpractical.com/view/AddWatchersOnCorrespond</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> # SEE: http://wiki.bestpractical.com/view/AddWatchersOnCorrespond</div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l198">Line 198:</td>
<td colspan="2" class="diff-lineno">Line 200:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> return 1;</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> return 1;</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td colspan="2" class="diff-side-deleted"></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></pre></ins></div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>==LoopIn External Configuration==</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">=</ins>== LoopIn External Configuration <ins style="font-weight: bold; text-decoration: none;">=</ins>==</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Additional rules can be defined for controlling access to LoopIn. The filename is defined in RT_SiteConfig.pm as follows:</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Additional rules can be defined for controlling access to LoopIn. The filename is defined in RT_SiteConfig.pm as follows:</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Set($WM_LoopAuth, "/opt/rt3/etc/loopauth.cfg");</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Set($WM_LoopAuth, "/opt/rt3/etc/loopauth.cfg");</div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l205">Line 205:</td>
<td colspan="2" class="diff-lineno">Line 208:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>A sample copy of this file with directive documentation is included below.</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>A sample copy of this file with directive documentation is included below.</div></td></tr>
<tr><td colspan="2" class="diff-side-deleted"></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2" class="diff-side-deleted"></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"><pre></ins></div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> # loopin address equivalences</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> # loopin address equivalences</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> #</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> #</div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l238">Line 238:</td>
<td colspan="2" class="diff-lineno">Line 243:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> # joe@bar.com can loop in baz.com addresses</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> # joe@bar.com can loop in baz.com addresses</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> domain baz.com joe@bar.com</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> domain baz.com joe@bar.com</div></td></tr>
<tr><td colspan="2" class="diff-side-deleted"></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></pre></ins></div></td></tr>
</table>
Tharn
https://rt-wiki.bestpractical.com/index.php?title=LoopIn&diff=1880&oldid=prev
Admin: 3 revisions imported
2016-04-06T20:14:19Z
<p>3 revisions imported</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 16:14, 6 April 2016</td>
</tr>
<!-- diff cache key bestpractical_mediawiki1459887241:diff::1.12:old-1879:rev-1880 -->
</table>
Admin
https://rt-wiki.bestpractical.com/index.php?title=LoopIn&diff=1879&oldid=prev
78.31.25.129 at 15:44, 27 January 2014
2014-01-27T15:44:02Z
<p></p>
<p><b>New page</b></p><div>==Update:==<br />
The code below didn't worked out of the box for me. I did some corrections, the code is available at: https://github.com/zito/rt-action-loopin. I'm have prepared it for RT 4.2.2.<br />
==Overview==<br />
<br />
We had a set of users who, when using our RT, would like to say they were "looping in" folks when they responded to tickets. This was a common practice in their regular mail, where the Cc list would be extended with new addresses and everyone would be sure to use Reply All for the latest message. After explaining repeatedly that RT doesn't work like that, I decided to find a way to make it work like that.<br />
<br />
I started with the existing [[AddWatchersOnCorrespond]]. That action itsef points out there are security problems with letting people send mail with additional addresses that then are automagically added as watchers, so this action takes some care to limit who is allowed to loop addresses into the ticket. The addresses authorized include:<br />
*Requestor<br />
*Cc and AdminCc addresses<br />
Additionally, there is a lookaside file with rules to permit addresses to loop in others within a specific domain. The permitted list can include specific authorized addresses or anyone at a domain.<br />
==RT::Action::LoopIn Module==<br />
package RT::Action::LoopIn;<br />
<br />
# SEE: http://wiki.bestpractical.com/view/AddWatchersOnCorrespond<br />
<br />
# This scrip will add new watchers based on message headers, but<br />
# only if the actor is authorized (is a requestor, cc, or admincc).<br />
<br />
use strict;<br />
<br />
use base qw(RT::Action);<br />
<br />
my $scrip = 'Scrip:LoopIn';<br />
<br />
# {{{ sub Describe<br />
sub Describe {<br />
my $self = shift;<br />
return (ref $self . " add new watchers from to/cc list if actor is authorized.");<br />
}<br />
# }}}<br />
<br />
# {{{ sub Prepare<br />
sub Prepare {<br />
# nothing to prepare<br />
return 1;<br />
}<br />
# }}}<br />
<br />
sub Commit {<br />
my $self = shift;<br />
my $Transaction = $self->TransactionObj;<br />
my $ActorAddr = $Transaction->CreatorObj->EmailAddress;<br />
my $Queue = $self->TicketObj->QueueObj;<br />
my $Ticket = $self->TicketObj;<br />
my $Id = $self->TicketObj->id;<br />
my @Authorized;<br />
my @Unauthorized;<br />
<br />
# assume it is NOT valid to loop in additional addresses<br />
my $loopin_authorized = 0;<br />
<br />
$RT::Logger->debug("$scrip: about to check if creator is authorized");<br />
<br />
# load email alias file, if present<br />
my %loopauth;<br />
my $loopauthfile = RT->Config->Get('WM_LoopAuth');<br />
if ($loopauthfile and my $fh = IO::File->new($loopauthfile)) {<br />
while (<$fh>) {<br />
chomp;<br />
s/^\s*//; # strip leading whitespace<br />
s/\s*$//; # strip trailing whitespace<br />
next if /^$/; # skip blank lines<br />
next if /^#/; # skip comment lines<br />
if (/^equiv\s+(\S+)\s+(\S+)$/i) {<br />
$loopauth{equiv}{lc($1)} = $2;<br />
}<br />
elsif (/^domain\s+(\S+)\s+(\S+)$/i) {<br />
$loopauth{domain}{lc($1)}->{lc($2)} = 1;<br />
}<br />
else {<br />
$RT::Logger->error("$scrip: unknown loopauth directive: $_");<br />
}<br />
}<br />
}<br />
<br />
# if actor is a requestor, cc or admincc, loopin is authorized<br />
if (my $Creator = $Transaction->CreatorObj) {<br />
my $Principal = $Creator->PrincipalId if $Creator->Id;<br />
$RT::Logger->debug("$scrip: creator principal ID: #$Principal");<br />
if (($Queue->IsCc($Principal) or<br />
$Queue->IsAdminCc($Principal) or<br />
$Ticket->IsCc($Principal) or<br />
$Ticket->IsAdminCc($Principal) or<br />
$Ticket->IsRequestor($Principal)<br />
)) {<br />
$loopin_authorized = 1;<br />
$RT::Logger->debug("$scrip: $ActorAddr is authorized to loop in additional watchers");<br />
}<br />
}<br />
<br />
$RT::Logger->debug("$scrip: about to extract candidate address list");<br />
<br />
# extract a list of to and cc addresses associated with this transaction<br />
for my $h (qw(To Cc)) {<br />
my $header = $Transaction->Attachments->First->GetHeader($h);<br />
for my $addrObj (Mail::Address->parse($header)) {<br />
# extract and normalize email address<br />
my $addr = lc $RT::Nobody->UserObj->CanonicalizeEmailAddress($addrObj->address);<br />
<br />
# ignore the specific addresses for this queue:<br />
next if lc $Queue->CorrespondAddress eq $addr or lc $Queue->CommentAddress eq $addr;<br />
<br />
# ignore any email address that looks like one for ANY of our queues:<br />
next if RT::EmailParser::IsRTAddress('', $addr);''<br />
<br />
# normalize address if equivalence is defined<br />
if (defined($loopauth{equiv}{$addr})) {<br />
$RT::Logger->debug("$scrip: normalizing $addr to $loopauth{equiv}{$addr}");<br />
$addr = $loopauth{equiv}{$addr};<br />
}<br />
<br />
# ignore any email address that is already a watcher<br />
my $User = RT::User->new($RT::SystemUser);<br />
$User->LoadByEmail($addr); # NOT LoadOrCreateByEmail<br />
my $Principal = $User->PrincipalId if $User->Id;<br />
next if ($Queue->IsCc($Principal) or<br />
$Queue->IsAdminCc($Principal) or<br />
$Ticket->IsCc($Principal) or<br />
$Ticket->IsAdminCc($Principal) or<br />
$Ticket->IsRequestor($Principal)<br />
);<br />
<br />
# extend additional watchers list if authorized<br />
if ($loopin_authorized or domainauth($loopauth{domain}, $ActorAddr, $addr)) {<br />
$RT::Logger->debug("$scrip: Ticket #$Id correspondence contains header - $h: $addr");<br />
push @Authorized, $addr;<br />
}<br />
else {<br />
push @Unauthorized, $addr;<br />
}<br />
}<br />
}<br />
<br />
my $comment = "";<br />
<br />
if (@Unauthorized) {<br />
$comment .= "$ActorAddr made an unauthorized attempt to loop in the following:\n " . join("\n ", @Unauthorized) . "\n";<br />
}<br />
<br />
$RT::Logger->debug("$scrip: about to add candidate addresses as watchers");<br />
<br />
# add authorized candidates not already listed as watchers<br />
if (@Authorized) {<br />
my @looped; # list of looped addresses<br />
my @failed; # list of failed addresses<br />
for my $addr (@Authorized) {<br />
my $User = RT::User->new($RT::SystemUser);<br />
$User->LoadOrCreateByEmail($addr);<br />
my $Principal = $User->PrincipalId if $User->Id;<br />
# add the new watcher and check for errors<br />
my ($ret, $msg) = $Ticket->AddWatcher(<br />
Type => 'Cc',<br />
Email => $addr,<br />
PrincipalId => $Principal,<br />
);<br />
if ($ret) {<br />
$RT::Logger->info("$scrip: New watcher added to ticket #$Id: $addr (#$Principal)");<br />
push(@looped, $addr);<br />
} else {<br />
$RT::Logger->error("$scrip: Failed to add new watcher to ticket #$Id: $addr (#$Principal) - $msg");<br />
push(@failed, $addr);<br />
}<br />
}<br />
if (@looped) {<br />
$comment .= "$ActorAddr successfully looped in the following:\n " . join("\n ", @looped) . "\n";<br />
}<br />
if (@failed) {<br />
$comment .= "$ActorAddr failed to loop in the following:\n " . join("\n ", @failed) . "\n";<br />
}<br />
}<br />
<br />
$Ticket->Comment(Content => $comment) if $comment;<br />
}<br />
<br />
sub domainauth {<br />
my $domainauth = shift;<br />
my $actor = shift;<br />
my $loopin = shift;<br />
my $loopin_domain;<br />
my $actor_domain;<br />
<br />
$RT::Logger->debug("$scrip: checking domainauth for $actor looping in $loopin");<br />
($loopin_domain = $loopin) =~ s/^[^@]+@//;<br />
($actor_domain = $actor) =~ s/^[^@]+@//;<br />
$RT::Logger->debug("$scrip: actor domain: $actor_domain, loopin domain: $loopin_domain");<br />
return 0 unless defined $domainauth;<br />
return 0 unless defined $domainauth->{$loopin_domain};<br />
return 1 if $domainauth->{lc($loopin_domain)}->{lc($actor)};<br />
return 1 if $domainauth->{lc($loopin_domain)}->{'*@'.lc($actor_domain)};<br />
return 0;<br />
}<br />
<br />
eval "require RT::Action::LoopIn_Vendor";<br />
die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/LoopIn_Vendor.pm});<br />
eval "require RT::Action::LoopIn_Local";<br />
die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/LoopIn_Local.pm});<br />
<br />
return 1;<br />
<br />
<br />
==LoopIn External Configuration==<br />
Additional rules can be defined for controlling access to LoopIn. The filename is defined in RT_SiteConfig.pm as follows:<br />
Set($WM_LoopAuth, "/opt/rt3/etc/loopauth.cfg");<br />
Note that the variable name includes a WM_ prefix for "Willing Minds", since I don't want to stomp on anything that might be defined by Best Practical or others later.<br />
<br />
A sample copy of this file with directive documentation is included below.<br />
# loopin address equivalences<br />
#<br />
# This defines address normalization rules to avoid adding duplicate <br />
# watchers.<br />
#<br />
# Format:<br />
#<br />
# equiv ORIGADDR NORMADDR<br />
#<br />
# If ORIGADDR is being looped in, it will be normalized to NORMADDR<br />
# before the existing watcher list is checked.<br />
<br />
# normalize foo.com users with example.com addresses<br />
equiv user1@example.com user1@foo.com<br />
equiv user2@example.com user2@foo.com<br />
<br />
<br />
# loopin domain permissions<br />
# <br />
# Format:<br />
#<br />
# domain DOMAIN FROMADDR<br />
#<br />
# If fromaddr includes To or Cc addresses that is in DOMAIN not on the<br />
# ticket, then those addresses will be looped into the ticket. The<br />
# special case '*@domain' format may be used for FROMADDR to indicate<br />
# that anyone in the domain is authorized.<br />
<br />
# anyone at foo.com can loop in foo.com addresses<br />
domain foo.com *@foo.com<br />
<br />
# joe@bar.com can loop in baz.com addresses<br />
domain baz.com joe@bar.com</div>
78.31.25.129