[Rt-commit] r4841 - in rtir/branches/1.9-EXPERIMENTAL: html/RTIR
ruz at bestpractical.com
ruz at bestpractical.com
Sun Mar 26 19:31:11 EST 2006
Author: ruz
Date: Sun Mar 26 19:31:09 2006
New Revision: 4841
Modified:
rtir/branches/1.9-EXPERIMENTAL/ (props changed)
rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Merge.html
Log:
r1037 at cubic-pc: cubic | 2006-03-27 04:30:27 +0400
* check rights in merge code
* take or steal tickets just before merge to get more rights
Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Merge.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Merge.html (original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Merge.html Sun Mar 26 19:31:09 2006
@@ -37,14 +37,8 @@
<& /Elements/ListActions, actions => \@results &>
-% unless ( $Ticket->CurrentUserHasRight('ModifyTicket') ) {
-<% loc("You are not allowed to merge this [_1].", $Type) %>
-% $m->abort();
-% }
-
<form action="<% RT->Config->Get('WebPath') %>/RTIR/Merge.html" method="post">
<input type="hidden" name="id" value="<% $id %>" />
-<input type="hidden" name="<% $id %>-MergeInto" />
<& /RTIR/Search/Elements/ShowResults,
Queue => $Queue,
@@ -64,19 +58,33 @@
<%INIT>
my $Ticket = LoadTicket($id);
$id = $ARGS{'id'} = $Ticket->id;
+
my ($Type) = $m->comp( 'Elements/Type', TicketObj => $Ticket );
my $Queue = $Ticket->QueueObj->Name;
# XXX: clear radio, checkboxes from format
$Format =~ s/__RTIR_(?:Radio|Check)__,//;
+my $take_or_steal = sub {
+ # XXX: we use such code all over the RTIR, we need one method
+ my $t = shift;
+ return 1 if $t->Owner == $t->CurrentUser->id;
+ return $t->Take if $t->Owner == $RT::Nobody->id;
+ return $t->Steal;
+};
+
my (@results);
if ( $SelectedTicket ) {
- $ARGS{ $id .'-MergeInto' } = $SelectedTicket;
my $MergeTicket = LoadTicket( $SelectedTicket );
+ $ARGS{ $id .'-MergeInto' } = $MergeTicket->id;
+
if ( $MergeTicket->QueueObj->id ne $Ticket->QueueObj->id ) {
push @results, loc("Merge failed: Ticket #[_1] is not the right type", $MergeTicket->Id );
} else {
+ foreach ( $Ticket, $MergeTicket ) {
+ my ($status, $msg) = $take_or_steal->( $_ );
+ push @results, $msg if $msg;
+ }
push @results, ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS);
}
}
More information about the Rt-commit
mailing list