[Rt-commit] r9352 - rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident

ruz at bestpractical.com ruz at bestpractical.com
Fri Oct 19 11:33:26 EDT 2007


Author: ruz
Date: Fri Oct 19 11:33:25 2007
New Revision: 9352

Modified:
   rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Reply.html

Log:
* add checks for keys during 'Abandon', 'Reply' and 'Reply To All' actions on Incidents

Modified: rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Reply.html
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Reply.html	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Reply.html	Fri Oct 19 11:33:25 2007
@@ -45,6 +45,8 @@
 <input type="hidden" name="All" value="<% $All %>" />
 <input type="hidden" name="Query" value="<% $Query %>" />
 
+<& /Elements/GnuPGKeyIssues, Issues => \@gnupg_keys_issues &>
+
 % my $recipients = 0;
 
 <h2><&|/l&>Reporters</&></h2>
@@ -151,7 +153,41 @@
 
 $m->comp( '/RTIR/Create.html:ProcessAttachments', %ARGS );
 
-if ( $SubmitTicket ) {
+my $checks_failure = 0;
+
+my @gnupg_keys_issues;
+if ( $SubmitTicket && $ARGS{'Encrypt'} ) {
+    require RT::Crypt::GnuPG;
+
+    my @recipients;
+
+    foreach my $id( @SelectedReports, @SelectedInvestigations, @SelectedBlocks ) {
+        my $Ticket = RT::Ticket->new( $session{'CurrentUser'} );
+        $Ticket->Load( $id );
+        unless( $Ticket->id ) {
+            push @results, loc( "Ticket [_1]: Couldn't load ticket.", $id );
+            next;
+        }
+        $id = $Ticket->id;
+
+        push @recipients, $m->comp(
+            '/Ticket/Elements/PreviewScrips:GetRecipients',
+            %ARGS, TicketObj => $Ticket
+        );
+    }
+
+    RT::Crypt::GnuPG::UseKeyForEncryption(
+        map { (/^UseKey-(.*)$/)[0] => $ARGS{ $_ } }
+        grep $ARGS{$_} && /^UseKey-/,
+        keys %ARGS
+    );
+
+    my $status;
+    ($status, @gnupg_keys_issues) = RT::Crypt::GnuPG::CheckRecipients( @recipients );
+    $checks_failure = 1 unless $status;
+}
+
+if ( $SubmitTicket && !$checks_failure ) {
     foreach my $id( @SelectedReports, @SelectedInvestigations, @SelectedBlocks ) {
         my $Ticket = RT::Ticket->new( $session{'CurrentUser'} );
         $Ticket->Load( $id );


More information about the Rt-commit mailing list