[Rt-commit] r5467 - in rtir/branches/1.9-EXPERIMENTAL: html/RTIR
html/RTIR/Incident
ruz at bestpractical.com
ruz at bestpractical.com
Mon Jun 26 10:11:00 EDT 2006
Author: ruz
Date: Mon Jun 26 10:10:59 2006
New Revision: 5467
Modified:
rtir/branches/1.9-EXPERIMENTAL/ (props changed)
rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Display.html
rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Edit.html
rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Display.html
rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Edit.html
rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/ShowChildren.html
Log:
r1530 at cubic-pc: cubic | 2006-06-26 18:18:01 +0400
* use StrictLinkACL config option to get rid of taking or stealling
tickets before linking
Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Display.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Display.html (original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Display.html Mon Jun 26 10:10:59 2006
@@ -251,7 +251,11 @@
$ARGS{UpdateAttachments} = delete $session{'Attachments'};
push @results, ProcessUpdateMessage( TicketObj => $Ticket, ARGSRef => \%ARGS );
push @results, ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS );
+
+ my $strict_acl = RT->Config->Set( StrictLinkACL => 0 );
push @results, ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS );
+ RT->Config->Set( StrictLinkACL => $strict_acl );
+
push @results, ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS );
my $newstate = $Ticket->FirstCustomFieldValue('_RTIR_State');
Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Edit.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Edit.html (original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Edit.html Mon Jun 26 10:10:59 2006
@@ -236,7 +236,11 @@
if ( $SaveChanges && !$OnlySearchForPeople ) {
my $oldstate = RT::IR::Ticket::FirstCustomFieldValue( $Ticket, '_RTIR_State' );
push @results, ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS );
+
+ my $strict_acl = RT->Config->Set( StrictLinkACL => 0 );
push @results, ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS );
+ RT->Config->Set( StrictLinkACL => $strict_acl );
+
push @results, ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS );
# XXX: edit page has no message box or attachments form
Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Display.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Display.html (original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Display.html Mon Jun 26 10:10:59 2006
@@ -236,40 +236,49 @@
}
Abort('No incident specified') unless $id;
+my $take_or_steal = sub {
+ my $owner = $_[0]->Owner;
+ return () if $owner == $session{'CurrentUser'}->id;
+ my $action = 'Steal';
+ $action = 'Take' if $owner == $RT::Nobody->id;
+ my ($res, $msg) = $_[0]->$action();
+ return $msg || ();
+};
+
my $deleted_links = 0;
my $DoLinks = sub {
- my $TicketObj = shift;
- my $Target = shift;
+ my ($child, $parent) = @_;
my %args = ();
# Blocks or Incedent Reports can have multiple incidents
- my ($Type) = $m->comp( "/RTIR/Elements/Type", TicketObj => $TicketObj );
+ my ($Type) = $m->comp( '/RTIR/Elements/Type', TicketObj => $child );
unless( $Type eq 'Block' || $Type eq 'Report' ) {
- # XXX: Can we ever get here?
- my $query = "Queue = 'Incidents' AND HasMember = ". $TicketObj->Id ." AND id != ". $Target->id;
- my $incidents = new RT::Tickets( $session{'CurrentUser'} );
+ my $query = "Queue = 'Incidents' AND HasMember = ". $child->Id ." AND id != ". $parent->id;
+ my $incidents = RT::Tickets->new( $session{'CurrentUser'} );
$incidents->FromSQL( $query );
while ( my $incident = $incidents->Next ) {
$deleted_links = 1;
- $args{'DeleteLink-'. $TicketObj->id .'-MemberOf-'. $incident->id } = '';
+ $args{'DeleteLink-'. $child->id .'-MemberOf-'. $incident->id } = '';
}
}
my @results;
- # If we own one end than take or steal other end of the link
- for my $obj( $Target, $TicketObj ) {
- next if $obj->Owner == $session{'CurrentUser'}->id;
- my $action = 'Steal';
- $action = 'Take' if $obj->Owner == $RT::Nobody->id;
- my ($res, $msg) = $obj->$action();
- push @results, $msg;
+
+ # if we don't own any of ends, take or steal parent
+ unless ( $parent->Owner == $session{'CurrentUser'}->id
+ || $child->Owner == $session{'CurrentUser'}->id )
+ {
+ push @results, $take_or_steal->( $parent );
}
- $args{ $TicketObj->Id .'-MemberOf' } = $Target->Id;
- push @results, ProcessTicketLinks( TicketObj => $TicketObj, ARGSRef => \%args );
+ # turn off strict check localy
+ my $strict_acl = RT->Config->Set( StrictLinkACL => 0 );
+ $args{ $child->Id .'-MemberOf' } = $parent->Id;
+ push @results, ProcessTicketLinks( TicketObj => $child, ARGSRef => \%args );
+ RT->Config->Set( StrictLinkACL => $strict_acl );
- return map { loc("Ticket [_1]: [_2]", $TicketObj->Id, $_) } @results;
+ return map { loc("Ticket [_1]: [_2]", $child->Id, $_) } @results;
};
my $TicketObj;
Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Edit.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Edit.html (original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Edit.html Mon Jun 26 10:10:59 2006
@@ -163,7 +163,11 @@
push @results, ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS);
push @results, ProcessTicketCustomFieldUpdates(ARGSRef => \%ARGS);
push @results, ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS);
+
+ my $strict_acl = RT->Config->Set( StrictLinkACL => 0 );
push @results, ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS);
+ RT->Config->Set( StrictLinkACL => $strict_acl );
+
$ARGS{UpdateAttachments} = $session{'Attachments'};
push @results, ProcessUpdateMessage( TicketObj => $Ticket, ARGSRef=>\%ARGS );
}
Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/ShowChildren.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/ShowChildren.html (original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/ShowChildren.html Mon Jun 26 10:10:59 2006
@@ -63,7 +63,10 @@
if( $ARGS{'Unlink'} ) {
# translate the checkbox args to what ProcessTicketLinks expects
$ARGS{'DeleteLink-'. $_ .'-MemberOf-'} = 1 for @SelectedTickets;
+
+ my $strict_acl = RT->Config->Set( StrictLinkACL => 0 );
push @results, ProcessTicketLinks( TicketObj => $Incident, ARGSRef => \%ARGS );
+ RT->Config->Set( StrictLinkACL => $strict_acl );
}
unless ( $Incident->CurrentUserHasRight('ShowTicket') ) {
More information about the Rt-commit
mailing list