[freeside-commits] branch FREESIDE_2_3_BRANCH updated. 28dd1fb8e816442196a14484618792f76f3cead7

Ivan ivan at 420.am
Wed Jun 20 16:37:48 PDT 2012


The branch, FREESIDE_2_3_BRANCH has been updated
       via  28dd1fb8e816442196a14484618792f76f3cead7 (commit)
      from  55705b162b7548c0362a435abdadaee7b81b169d (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 28dd1fb8e816442196a14484618792f76f3cead7
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed Jun 20 16:37:47 2012 -0700

    ACLs for advanced customer and service searching, RT#18157

diff --git a/FS/FS/AccessRight.pm b/FS/FS/AccessRight.pm
index 4aa777b..eb9974a 100644
--- a/FS/FS/AccessRight.pm
+++ b/FS/FS/AccessRight.pm
@@ -258,6 +258,7 @@ tie my %rights, 'Tie::IxHash',
   'Reporting/listing rights' => [
     'List customers',
     'List all customers',
+    'Advanced customer search',
     'List zip codes', #NEW
     'List invoices',
     'List packages',
@@ -274,14 +275,17 @@ tie my %rights, 'Tie::IxHash',
 
     'Download report data',
     'Services: Accounts',
+    'Services: Accounts: Advanced search',
     'Services: Domains',
     'Services: Certificates',
     'Services: Mail forwards',
     'Services: Virtual hosting services',
     'Services: Wireless broadband services',
+    'Services: Wireless broadband services: Advanced search',
     'Services: DSLs',
     'Services: Dish services',
     'Services: Hardware',
+    'Services: Hardware: Advanced search',
     'Services: Phone numbers',
     'Services: PBXs',
     'Services: Ports',
diff --git a/FS/FS/access_right.pm b/FS/FS/access_right.pm
index 52cae34..1e65ca3 100644
--- a/FS/FS/access_right.pm
+++ b/FS/FS/access_right.pm
@@ -2,6 +2,7 @@ package FS::access_right;
 
 use strict;
 use vars qw( @ISA );
+use Tie::IxHash;
 use FS::Record qw( qsearch qsearchs );
 use FS::upgrade_journal;
 
@@ -183,8 +184,9 @@ sub _upgrade_data { # class method
 
   my @all_groups = qsearch('access_group', {});
 
-  my %onetime = (
+  tie my %onetime, 'Tie::IxHash',
     'List customers'                      => 'List all customers',
+    'List all customers'                  => 'Advanced customer search',
     'List packages'                       => 'Summarize packages',
     'Post payment'                        => 'Backdate payment',
     'Cancel customer package immediately' => 'Un-cancel customer package',
@@ -206,11 +208,16 @@ sub _upgrade_data { # class method
                             'Services: Mailing lists',
                             'Services: External services',
                           ],
+
+    'Services: Accounts' => 'Services: Accounts: Advanced search',
+    'Services: Wireless broadband services' => 'Services: Wireless broadband services: Advanced search',
+    'Services: Hardware' => 'Services: Hardware: Advanced search',
+
     'List rating data' => [ 'Usage: RADIUS sessions',
                             'Usage: Call Detail Records (CDRs)',
                             'Usage: Unrateable CDRs',
                           ],
-  );
+  ;
 
   foreach my $old_acl ( keys %onetime ) {
 
diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html
index 0f1fa0c..cdae71f 100644
--- a/httemplate/elements/menu.html
+++ b/httemplate/elements/menu.html
@@ -110,8 +110,7 @@ $report_customers{'List customers'} = [ \%report_customers_lists, 'List customer
 $report_customers{'Zip code distribution'}     = [ $fsurl. 'search/report_cust_main-zip.html', 'Zip codes by number of customers' ];
 $report_customers{'Customer signup report'}       = [ $fsurl. 'graph/report_cust_signup.html', 'New customer signups by date' ],
 $report_customers{'Advanced customer reports'} = [ $fsurl. 'search/report_cust_main.html', 'by status, signup date, agent, etc.' ]
-  if    $curuser->access_right('List customers')
-     && $curuser->access_right('List packages');
+  if $curuser->access_right('Advanced customer search');
 
 tie my %report_invoices_open, 'Tie::IxHash',
   'All open invoices' => [ $fsurl.'search/cust_bill.html?OPEN_date', 'All invoices with an unpaid balance' ],
@@ -201,10 +200,10 @@ foreach my $svcdb ( FS::part_svc->svc_tables() ) {
       ];
   }
 
-  if ( $svcdb =~ /^svc_(acct|broadband|hardware)$/ ) {
     $report_svc{"Advanced $lcsname reports"} = 
-      [ $fsurl."search/report_$svcdb.html", '' ];
-  }
+        [ $fsurl."search/report_$svcdb.html", '' ]
+      if $svcdb =~ /^svc_(acct|broadband|hardware)$/
+      && $curuser->access_right("Services: $name: Advanced search");
 
   if ( $svcdb eq 'svc_phone' ) {
 
@@ -221,8 +220,8 @@ foreach my $svcdb ( FS::part_svc->svc_tables() ) {
 
   }
 
-  $report_services{$name} = [ \%report_svc, $longname ] if
-    $curuser->access_right("Services: $name");
+  $report_services{$name} = [ \%report_svc, $longname ]
+    if $curuser->access_right("Services: $name");
 
 }
 
diff --git a/httemplate/search/cust_main.html b/httemplate/search/cust_main.html
index bb5eae7..cc71672 100755
--- a/httemplate/search/cust_main.html
+++ b/httemplate/search/cust_main.html
@@ -33,9 +33,7 @@
 <%init>
 
 die "access denied"
-  unless ( $FS::CurrentUser::CurrentUser->access_right('List customers') &&
-           $FS::CurrentUser::CurrentUser->access_right('List packages')
-         );
+  unless $FS::CurrentUser::CurrentUser->access_right('Advanced customer search');
 
 my %search_hash = ();
 
diff --git a/httemplate/search/report_cust_main.html b/httemplate/search/report_cust_main.html
index c7a3ad9..04e04ee 100755
--- a/httemplate/search/report_cust_main.html
+++ b/httemplate/search/report_cust_main.html
@@ -171,9 +171,7 @@
 <%init>
 
 die "access denied"
-  unless ( $FS::CurrentUser::CurrentUser->access_right('List customers') &&
-           $FS::CurrentUser::CurrentUser->access_right('List packages')
-         );
+  unless $FS::CurrentUser::CurrentUser->access_right('Advanced customer search');
 
 my $conf = new FS::Conf;
 
diff --git a/httemplate/search/report_svc_acct.html b/httemplate/search/report_svc_acct.html
index 14c284f..74bf553 100755
--- a/httemplate/search/report_svc_acct.html
+++ b/httemplate/search/report_svc_acct.html
@@ -114,7 +114,7 @@
 <%init>
 
 die "access denied"
-  unless $FS::CurrentUser::CurrentUser->access_right('List packages'); #?
+  unless $FS::CurrentUser::CurrentUser->access_right('Services: Accounts: Advanced search'); #?
 
 my $title = emt('Account Report');
 
diff --git a/httemplate/search/report_svc_broadband.html b/httemplate/search/report_svc_broadband.html
index 37f21b7..d7422ee 100755
--- a/httemplate/search/report_svc_broadband.html
+++ b/httemplate/search/report_svc_broadband.html
@@ -76,7 +76,7 @@
 <%init>
 
 die "access denied"
-  unless $FS::CurrentUser::CurrentUser->access_right('List packages'); #?
+  unless $FS::CurrentUser::CurrentUser->access_right('Services: Wireless broadband services: Advanced search');
 
 my $title = 'Broadband Service Report';
 my $routernum = [ $cgi->param('routernum') || '' ];
diff --git a/httemplate/search/report_svc_hardware.html b/httemplate/search/report_svc_hardware.html
index 61ba4ab..b0bfc08 100755
--- a/httemplate/search/report_svc_hardware.html
+++ b/httemplate/search/report_svc_hardware.html
@@ -61,7 +61,7 @@ OR (SELECT COUNT(*) FROM svc_hardware
 <%init>
 
 die "access denied"
-  unless $FS::CurrentUser::CurrentUser->access_right('List packages'); #?
+  unless $FS::CurrentUser::CurrentUser->access_right('Services: Hardware: Advanced search');
 
 my $title = 'Hardware Service Report';
 

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

Summary of changes:
 FS/FS/AccessRight.pm                        |    4 ++++
 FS/FS/access_right.pm                       |   11 +++++++++--
 httemplate/elements/menu.html               |   13 ++++++-------
 httemplate/search/cust_main.html            |    4 +---
 httemplate/search/report_cust_main.html     |    4 +---
 httemplate/search/report_svc_acct.html      |    2 +-
 httemplate/search/report_svc_broadband.html |    2 +-
 httemplate/search/report_svc_hardware.html  |    2 +-
 8 files changed, 24 insertions(+), 18 deletions(-)




More information about the freeside-commits mailing list