[freeside-commits] branch master updated. 3bbe0f73c2afbbe182fe8a0a6490ba1700152742

Ivan ivan at 420.am
Wed May 2 15:47:52 PDT 2012


The branch, master has been updated
       via  3bbe0f73c2afbbe182fe8a0a6490ba1700152742 (commit)
      from  14b88fec3eb275ae5339bb7ad1d72bdb333454c0 (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 3bbe0f73c2afbbe182fe8a0a6490ba1700152742
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed May 2 15:47:51 2012 -0700

    fix ACL upgrade, RT#17056

diff --git a/FS/FS/AccessRight.pm b/FS/FS/AccessRight.pm
index a39fb37..a11ad7f 100644
--- a/FS/FS/AccessRight.pm
+++ b/FS/FS/AccessRight.pm
@@ -288,7 +288,6 @@ tie my %rights, 'Tie::IxHash',
     'Usage: Call Detail Records (CDRs)',
     'Usage: Unrateable CDRs',
     'Usage: Time worked',
-    'Usage: Time worked summary',
 
     #{ rightname => 'List customers of all agents', global=>1 },
   ],
diff --git a/FS/FS/access_right.pm b/FS/FS/access_right.pm
index 719577f..fc01746 100644
--- a/FS/FS/access_right.pm
+++ b/FS/FS/access_right.pm
@@ -183,9 +183,28 @@ sub _upgrade_data { # class method
   my @all_groups = qsearch('access_group', {});
 
   my %onetime = (
-    'List customers' => 'List all customers',
-    'List packages'  => 'Summarize packages',
-    'Post payment'   => 'Backdate payment',
+    'List customers'   => 'List all customers',
+    'List packages'    => 'Summarize packages',
+    'Post payment'     => 'Backdate payment',
+    'List services'    => [ 'Services: Accounts',
+                            'Services: Domains',
+                            'Services: Certificates',
+                            'Services: Mail forwards',
+                            'Services: Virtual hosting services',
+                            'Services: Wireless broadband services',
+                            'Services: DSLs',
+                            'Services: Dish services',
+                            'Services: Hardware',
+                            'Services: Phone numbers',
+                            'Services: PBXs',
+                            'Services: Ports',
+                            'Services: Mailing lists',
+                            'Services: External services',
+                          ],
+    'List rating data' => [ 'Usage: RADIUS sessions',
+                            'Usage: Call Detail Records (CDRs)',
+                            'Usage: Unrateable CDRs',
+                          ],
   );
 
   foreach my $old_acl ( keys %onetime ) {
@@ -196,20 +215,20 @@ sub _upgrade_data { # class method
 
     foreach my $new_acl ( @new_acl ) {
 
-      ( my $journal = 'ACL_'.lc($new_acl) ) =~ s/ /_/g;
+      ( my $journal = 'ACL_'.lc($new_acl) ) =~ s/\W/_/g;
       next if FS::upgrade_journal->is_done($journal);
 
       # grant $new_acl to all groups who have $old_acl
       for my $group (@all_groups) {
-        if ( $group->access_right($old_acl) ) {
-          my $access_right = FS::access_right->new( {
-              'righttype'   => 'FS::access_group',
-              'rightobjnum' => $group->groupnum,
-              'rightname'   => $new_acl,
-          } );
-          my $error = $access_right->insert;
-          die $error if $error;
-        }
+        next unless $group->access_right($old_acl);
+        next if     $group->access_right($new_acl);
+        my $access_right = FS::access_right->new( {
+            'righttype'   => 'FS::access_group',
+            'rightobjnum' => $group->groupnum,
+            'rightname'   => $new_acl,
+        } );
+        my $error = $access_right->insert;
+        die $error if $error;
       }
     
       FS::upgrade_journal->set_done($journal);
diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html
index fc8664a..42feb7b 100644
--- a/httemplate/elements/menu.html
+++ b/httemplate/elements/menu.html
@@ -254,15 +254,17 @@ tie my %report_inventory, 'Tie::IxHash',
   'Inventory activity' => [ $fsurl.'search/report_h_inventory_item.html', '' ],
 ;
 
-my @report_rating = ();
-push(@report_rating, 'RADIUS sessions' => [ $fsurl.'search/sqlradius.html', '' ]) if $curuser->access_right("Usage: RADIUS sessions");
-push(@report_rating, 'Call Detail Records (CDRs)' => [ $fsurl.'search/report_cdr.html', '' ]) if $curuser->access_right("Usage: Call Detail Records (CDRs)");
-push(@report_rating, 'Unrateable CDRs' => [ $fsurl.'search/cdr.html?freesidestatus=failed'.
-    ';cdrbatchnum=_ALL_' ]) if $curuser->access_right("Usage: Unrateable CDRs");
-push(@report_rating, 'Time worked' => [ $fsurl.'search/report_rt_transaction.html', '' ]) if $curuser->access_right("Usage: Time worked");
-push(@report_rating, 'Time worked summary' => [ $fsurl.'search/report_rt_ticket.html', '' ]) if $curuser->access_right("Usage: Time worked summary");
-
-tie my %report_rating, 'Tie::IxHash', @report_rating;
+tie my %report_rating, 'Tie::IxHash';
+$report_rating{'RADIUS sessions'} = [ $fsurl.'search/sqlradius.html', '' ]
+  if $curuser->access_right("Usage: RADIUS sessions");
+$report_rating{'Call Detail Records (CDRs)'} = [ $fsurl.'search/report_cdr.html', '' ]
+  if $curuser->access_right("Usage: Call Detail Records (CDRs)");
+$report_rating{'Unrateable CDRs'} = [ $fsurl.'search/cdr.html?freesidestatus=failed;cdrbatchnum=_ALL_' ]
+  if $curuser->access_right("Usage: Unrateable CDRs");
+if ( $curuser->access_right("Usage: Time worked") ) {
+  $report_rating{'Time worked'} = [ $fsurl.'search/report_rt_transaction.html', '' ];
+  $report_rating{'Time worked summary'} = [ $fsurl.'search/report_rt_ticket.html', '' ];
+}
 
 tie my %report_ticketing_statistics, 'Tie::IxHash',
   'Tickets per day per Queue'         => [ $fsurl.'rt/RTx/Statistics/CallsQueueDay', 'View the number of tickets created, resolved or deleted in a specific Queue, over the requested period of days' ],

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

Summary of changes:
 FS/FS/AccessRight.pm          |    1 -
 FS/FS/access_right.pm         |   45 +++++++++++++++++++++++++++++-----------
 httemplate/elements/menu.html |   20 ++++++++++--------
 3 files changed, 43 insertions(+), 23 deletions(-)




More information about the freeside-commits mailing list