[freeside-commits] branch FREESIDE_2_3_BRANCH updated. 9e710a89ff6b8a1e6b0dc407e7522390dc168079

Ivan ivan at 420.am
Wed Apr 4 15:50:23 PDT 2012


The branch, FREESIDE_2_3_BRANCH has been updated
       via  9e710a89ff6b8a1e6b0dc407e7522390dc168079 (commit)
       via  685f35c0d8d08ea7bbf2ac7cf2db19cdc79fcccf (commit)
       via  3075e4648ca64d58c3458195ddda34235b4aae59 (commit)
      from  341ee4847da0f09898b07f35e5b3d43d3b687805 (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 9e710a89ff6b8a1e6b0dc407e7522390dc168079
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed Apr 4 15:50:23 2012 -0700

    add "Summarize packages" ACL, RT#16534

diff --git a/FS/FS/access_right.pm b/FS/FS/access_right.pm
index d2a39aa..341055b 100644
--- a/FS/FS/access_right.pm
+++ b/FS/FS/access_right.pm
@@ -182,23 +182,30 @@ sub _upgrade_data { # class method
 
   my @all_groups = qsearch('access_group', {});
 
-  ### ACL_list_all_customers
-  if ( !FS::upgrade_journal->is_done('ACL_list_all_customers') ) {
+  my %onetime = (
+    'List customers' => 'List all customers',
+    'List packages'  => 'Summarize packages',
+  );
+
+  foreach my $old_acl ( keys %onetime ) {
+    my $new_acl = $onetime{$old_acl}; #support arrayref too?
+    ( my $journal = 'ACL_'.lc($new_acl) ) =~ s/ /_/g;
+    next if FS::upgrade_journal->is_done($journal);
 
-    # grant "List all customers" to all users who have "List customers"
+    # grant $new_acl to all groups who have $old_acl
     for my $group (@all_groups) {
-      if ( $group->access_right('List customers') ) {
+      if ( $group->access_right($old_acl) ) {
         my $access_right = FS::access_right->new( {
             'righttype'   => 'FS::access_group',
             'rightobjnum' => $group->groupnum,
-            'rightname'   => 'List all customers',
+            'rightname'   => $new_acl,
         } );
         my $error = $access_right->insert;
         die $error if $error;
       }
     }
     
-    FS::upgrade_journal->set_done('ACL_list_all_customers');
+    FS::upgrade_journal->set_done($journal);
   }
 
   ### ACL_download_report_data

commit 685f35c0d8d08ea7bbf2ac7cf2db19cdc79fcccf
Merge: 3075e46 341ee48
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed Apr 4 15:41:26 2012 -0700

    Merge branch 'FREESIDE_2_3_BRANCH' of git.freeside.biz:/home/git/freeside into FREESIDE_2_3_BRANCH


commit 3075e4648ca64d58c3458195ddda34235b4aae59
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed Apr 4 15:31:17 2012 -0700

    add "Summarize packages" ACL, RT#16534

diff --git a/FS/FS/AccessRight.pm b/FS/FS/AccessRight.pm
index 1bfae03..06263c2 100644
--- a/FS/FS/AccessRight.pm
+++ b/FS/FS/AccessRight.pm
@@ -256,6 +256,7 @@ tie my %rights, 'Tie::IxHash',
     'List zip codes', #NEW
     'List invoices',
     'List packages',
+    'Summarize packages',
     'List services',
     'List service passwords',
   
@@ -361,6 +362,7 @@ sub default_superuser_rights {
     'Delete payment',
     'Delete credit', #?
     'Delete refund', #?
+    'Edit customer package dates',
     'Time queue',
     'Redownload resolved batches',
     'Raw SQL',
diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html
index eb63712..d61d44e 100644
--- a/httemplate/elements/menu.html
+++ b/httemplate/elements/menu.html
@@ -238,9 +238,11 @@ if ( $curuser->access_right('Financial reports') ) {
   $report_packages{'separator2'} =  '';
 }
 $report_packages{'All customer packages'} =  [ $fsurl.'search/cust_pkg.cgi?pkgnum', 'List all customer packages', ];
-$report_packages{'Package summary'} = [ $fsurl.'search/cust_pkg_summary.html', 'Show package sales summary', ];
+$report_packages{'Package summary'} = [ $fsurl.'search/cust_pkg_summary.html', 'Show package sales summary', ]
+  if $curuser->access_right('Summarize packages');
 $report_packages{'Suspended customer packages'} =  [ $fsurl.'search/cust_pkg.cgi?magic=suspended', 'List suspended packages' ];
-$report_packages{'Suspension summary'} = [ $fsurl.'search/cust_pkg_susp.html', 'Show suspension activity', ];
+$report_packages{'Suspension summary'} = [ $fsurl.'search/cust_pkg_susp.html', 'Show suspension activity', ]
+  if $curuser->access_right('Summarize packages');
 $report_packages{'Customer packages with unconfigured services'} =  [ $fsurl.'search/cust_pkg.cgi?APKG_pkgnum', 'List packages which have provisionable services' ];
 $report_packages{'FCC Form 477 packages'} =  [ $fsurl.'search/report_477.html', 'Summarize packages by census tract for particular types' ]
   if $conf->exists('cust_main-require_censustract');
diff --git a/httemplate/search/cust_pkg_summary.cgi b/httemplate/search/cust_pkg_summary.cgi
index cea4cdc..fbeeb92 100644
--- a/httemplate/search/cust_pkg_summary.cgi
+++ b/httemplate/search/cust_pkg_summary.cgi
@@ -25,7 +25,7 @@
 my $curuser = $FS::CurrentUser::CurrentUser;
 
 die "access denied"
-  unless $curuser->access_right('List packages');
+  unless $curuser->access_right('Summarize packages');
 
 my $title = 'Package Summary Report';
 my ($begin, $end) = FS::UI::Web::parse_beginning_ending($cgi);
diff --git a/httemplate/search/cust_pkg_summary.html b/httemplate/search/cust_pkg_summary.html
index a0ef472..f9adf04 100644
--- a/httemplate/search/cust_pkg_summary.html
+++ b/httemplate/search/cust_pkg_summary.html
@@ -21,4 +21,8 @@
 
 <% include('/elements/footer.html') %>
 <%init>
+
+die "access denied"
+  unless $curuser->access_right('Summarize packages');
+
 </%init>
diff --git a/httemplate/search/cust_pkg_susp.cgi b/httemplate/search/cust_pkg_susp.cgi
index 9ab5992..d6bbc43 100644
--- a/httemplate/search/cust_pkg_susp.cgi
+++ b/httemplate/search/cust_pkg_susp.cgi
@@ -25,7 +25,7 @@
 my $curuser = $FS::CurrentUser::CurrentUser;
 
 die "access denied"
-  unless $curuser->access_right('List packages');
+  unless $curuser->access_right('Summarize packages');
 
 my $money_char = FS::Conf->new()->config('money_char') || '$';
 
diff --git a/httemplate/search/cust_pkg_susp.html b/httemplate/search/cust_pkg_susp.html
index c59e6c1..2ac6432 100644
--- a/httemplate/search/cust_pkg_susp.html
+++ b/httemplate/search/cust_pkg_susp.html
@@ -21,4 +21,8 @@
 
 <% include('/elements/footer.html') %>
 <%init>
+
+die "access denied"
+  unless $curuser->access_right('Summarize packages');
+
 </%init>

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

Summary of changes:
 FS/FS/AccessRight.pm                    |    2 ++
 FS/FS/access_right.pm                   |   19 +++++++++++++------
 httemplate/elements/menu.html           |    6 ++++--
 httemplate/search/cust_pkg_summary.cgi  |    2 +-
 httemplate/search/cust_pkg_summary.html |    4 ++++
 httemplate/search/cust_pkg_susp.cgi     |    2 +-
 httemplate/search/cust_pkg_susp.html    |    4 ++++
 7 files changed, 29 insertions(+), 10 deletions(-)




More information about the freeside-commits mailing list