[Bps-public-commit] r15180 - in RT-Extension-CommandByEmail: .

sartak at bestpractical.com sartak at bestpractical.com
Thu Aug 14 22:48:49 EDT 2008


Author: sartak
Date: Thu Aug 14 22:48:48 2008
New Revision: 15180

Modified:
   RT-Extension-CommandByEmail/   (props changed)
   RT-Extension-CommandByEmail/lib/RT/Interface/Email/Filter/TakeAction.pm

Log:
 r69668 at onn:  sartak | 2008-08-14 22:48:27 -0400
 Initial implementation of limiting command by mail to a group through config


Modified: RT-Extension-CommandByEmail/lib/RT/Interface/Email/Filter/TakeAction.pm
==============================================================================
--- RT-Extension-CommandByEmail/lib/RT/Interface/Email/Filter/TakeAction.pm	(original)
+++ RT-Extension-CommandByEmail/lib/RT/Interface/Email/Filter/TakeAction.pm	Thu Aug 14 22:48:48 2008
@@ -163,6 +163,23 @@
         return ( $args{'CurrentUser'}, $args{'AuthLevel'} );
     }
 
+    # If only a particular group may perform commands by mail,
+    # bail out
+    my $old_config = $RT::VERSION =~ /3\.(\d+)/ && $1 < 7;
+    my $group_id = $old_config
+                 ? $RT::CommandByMailGroup
+                 : RT->Config->Get('CommandByMailGroup');
+
+    if (defined $group_id) {
+        my $group = RT::Group->new($args{'CurrentUser'});
+        $group->Load($group_id);
+
+        unless ($group->HasMemberRecursively($args{'CurrentUser'}->Id)) {
+            return ($args{'CurrentUser'}, $args{'AuthLevel'});
+        }
+    }
+
+    # find the content
     my @content;
     my @parts = $args{'Message'}->parts_DFS;
     foreach my $part (@parts) {



More information about the Bps-public-commit mailing list