[freeside-commits] branch master updated. 7c5f50804027577aac17d0fcefedcd0d0b6ca180

Mark Wells mark at 420.am
Sun Nov 27 21:16:25 PST 2016


The branch, master has been updated
       via  7c5f50804027577aac17d0fcefedcd0d0b6ca180 (commit)
       via  bcfa8b9c306cc871b5851d7c07ef0759eb1bcb31 (commit)
      from  e42db9683dee82d6991a4205642d5babb3d52f2f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 7c5f50804027577aac17d0fcefedcd0d0b6ca180
Author: Mark Wells <mark at freeside.biz>
Date:   Sun Nov 27 16:43:19 2016 -0800

    add RT ACL for bulk updating tickets, #72964
    
    Conflicts:
    	rt/lib/RT/System.pm

diff --git a/FS/FS/TicketSystem.pm b/FS/FS/TicketSystem.pm
index 8f3d7af..c973c88 100644
--- a/FS/FS/TicketSystem.pm
+++ b/FS/FS/TicketSystem.pm
@@ -401,6 +401,25 @@ sub _upgrade_data {
     warn "Fixed $rows transactions with empty time values\n" if $rows > 0;
   }
 
+  # One-time fix: We've created a "BulkUpdateTickets" access right; grant
+  # it to all auth'd users initially.
+  eval "use FS::upgrade_journal;";
+  my $upgrade = 'RT_add_BulkUpdateTickets_ACL';
+  if (!FS::upgrade_journal->is_done($upgrade)) {
+    my $groups = RT::Groups->new(RT->SystemUser);
+    $groups->LimitToEnabled;
+    $groups->LimitToSystemInternalGroups;
+    $groups->Limit(FIELD => 'Type', VALUE => 'Privileged', OPERATOR => '=');
+    my $group = $groups->First
+      or die "No RT internal group found for Privileged users";
+    my ($val, $msg) = $group->PrincipalObj->GrantRight(
+      Right => 'BulkUpdateTickets', Object => RT->System
+    );
+    die "Couldn't grant BulkUpdateTickets right to all users: $msg\n"
+      if !$val;
+    FS::upgrade_journal->set_done($upgrade);
+  }
+
   return;
 }
 
diff --git a/rt/FREESIDE_MODIFIED b/rt/FREESIDE_MODIFIED
index 05ffb2a..db5212d 100644
--- a/rt/FREESIDE_MODIFIED
+++ b/rt/FREESIDE_MODIFIED
@@ -171,3 +171,9 @@ share/html/Search/Schedule.html
 share/html/Elements/CalendarSlotSchedule
 share/html/Ticket/Display.html
 
+# BulkUpdateTickets ACL
+lib/RT/System.pm
+share/html/Elements/Tabs
+share/html/Search/Bulk.html
+share/html/Ticket/Elements/Tabs
+
diff --git a/rt/lib/RT/System.pm b/rt/lib/RT/System.pm
index 388a1fd..af7a22b 100644
--- a/rt/lib/RT/System.pm
+++ b/rt/lib/RT/System.pm
@@ -92,6 +92,9 @@ __PACKAGE__->AddRight( General => LoadSavedSearch     => 'Allow loading of saved
 __PACKAGE__->AddRight( General => CreateSavedSearch   => 'Allow creation of saved searches'); # loc
 __PACKAGE__->AddRight( Admin   => ExecuteCode         => 'Allow writing Perl code in templates, scrips, etc'); # loc
 
+#freeside
+__PACKAGE__->AddRight( Staff   => BulkUpdateTickets   => 'Bulk update tickets');
+
 =head2 AvailableRights
 
 Returns a hashref of available rights for this object.  The keys are the
diff --git a/rt/share/html/Elements/Tabs b/rt/share/html/Elements/Tabs
index 297d907..aef27ed 100755
--- a/rt/share/html/Elements/Tabs
+++ b/rt/share/html/Elements/Tabs
@@ -847,7 +847,10 @@ my $build_main_nav = sub {
         }
 
         if ( $has_query ) {
-            $current_search_menu->child( bulk  => title => loc('Bulk Update'), path => "/Search/Bulk.html$args" );
+            #freeside
+            if ( $session{'CurrentUser'}->HasRight( Right => 'BulkUpdateTickets', Object => RT->System ) ) {
+              $current_search_menu->child( bulk  => title => loc('Bulk Update'), path => "/Search/Bulk.html$args" );
+            }
             $current_search_menu->child( chart => title => loc('Chart'),       path => "/Search/Chart.html$args" );
 
             #formerly Callbacks/RTx-Calendar/Ticket/Element/Tabs/Default
diff --git a/rt/share/html/Search/Bulk.html b/rt/share/html/Search/Bulk.html
index bacd96c..38b29fe 100755
--- a/rt/share/html/Search/Bulk.html
+++ b/rt/share/html/Search/Bulk.html
@@ -203,6 +203,13 @@ unless ( defined $Rows ) {
 }
 my $title = loc("Update multiple tickets");
 
+#freeside
+unless ( $session{'CurrentUser'}
+         ->HasRight( Right => 'BulkUpdateTickets', Object => RT->System) )
+{
+    Abort('You are not allowed to bulk-update tickets.');
+}
+
 # Iterate through the ARGS hash and remove anything with a null value.
 map ( $ARGS{$_} =~ /^$/ && ( delete $ARGS{$_} ), keys %ARGS );
 
diff --git a/rt/share/html/Ticket/Elements/Tabs b/rt/share/html/Ticket/Elements/Tabs
index 2f89dc6..bcc97e5 100755
--- a/rt/share/html/Ticket/Elements/Tabs
+++ b/rt/share/html/Ticket/Elements/Tabs
@@ -326,10 +326,15 @@ if ($has_query) {
         title => loc('Show Results'),
     };
 
-    $tabs->{"j"} = {
-        path  => "Search/Bulk.html$args",
-        title => loc('Bulk Update'),
-    };
+    #freeside
+    if ( $session{'CurrentUser'}
+         ->HasRight(Right => 'BulkUpdateTickets', Object => $RT::System) )
+    {
+      $tabs->{"j"} = {
+          path  => "Search/Bulk.html$args",
+          title => loc('Bulk Update'),
+      };
+    }
 
     $tabs->{"k"} = {
         path  => "Search/Chart.html$args",

commit bcfa8b9c306cc871b5851d7c07ef0759eb1bcb31
Author: Mark Wells <mark at freeside.biz>
Date:   Wed Nov 23 15:25:31 2016 -0800

    avoid setting logfile path too early, from #37802

diff --git a/FS/FS/Daemon.pm b/FS/FS/Daemon.pm
index 4ecd80e..a3c16d8 100644
--- a/FS/FS/Daemon.pm
+++ b/FS/FS/Daemon.pm
@@ -64,12 +64,6 @@ sub daemonize1 {
     $SIG{TERM} = sub { warn "SIGTERM received; shutting down\n"; $sigterm++; };
   }
 
-  # set the logfile sensibly
-  if (!$logfile) {
-    my $logname = $me;
-    $logname =~ s/^freeside-//;
-    logfile("%%%FREESIDE_LOG%%%/$logname-log.$FS::UID::datasrc");
-  }
 }
 
 sub drop_root {
@@ -122,6 +116,12 @@ sub _die {
 
 sub _logmsg {
   chomp( my $msg = shift );
+  # set the logfile sensibly
+  if (!$logfile) {
+    my $logname = $me;
+    $logname =~ s/^freeside-//;
+    logfile("%%%FREESIDE_LOG%%%/$logname-log.$FS::UID::datasrc");
+  }
   my $log = new IO::File ">>$logfile";
   flock($log, LOCK_EX);
   seek($log, 0, 2);

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/Daemon.pm                    |   12 ++++++------
 FS/FS/TicketSystem.pm              |   19 +++++++++++++++++++
 rt/FREESIDE_MODIFIED               |    6 ++++++
 rt/lib/RT/System.pm                |    3 +++
 rt/share/html/Elements/Tabs        |    5 ++++-
 rt/share/html/Search/Bulk.html     |    7 +++++++
 rt/share/html/Ticket/Elements/Tabs |   13 +++++++++----
 7 files changed, 54 insertions(+), 11 deletions(-)




More information about the freeside-commits mailing list