[freeside-commits] branch master updated. 458154df5fb1ebf983458007e266da130b706ef7

Ivan ivan at 420.am
Mon Apr 15 19:19:04 PDT 2013


The branch, master has been updated
       via  458154df5fb1ebf983458007e266da130b706ef7 (commit)
      from  6f97b139aca5de337dd8bfaa62959eda62a1607a (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 458154df5fb1ebf983458007e266da130b706ef7
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Mon Apr 15 19:18:53 2013 -0700

    add separate ACL for employee reports, RT#22516

diff --git a/FS/FS/AccessRight.pm b/FS/FS/AccessRight.pm
index a60d033..bfb39b4 100644
--- a/FS/FS/AccessRight.pm
+++ b/FS/FS/AccessRight.pm
@@ -305,6 +305,8 @@ tie my %rights, 'Tie::IxHash',
     'Usage: Call Detail Records (CDRs)',
     'Usage: Unrateable CDRs',
     'Usage: Time worked',
+    { rightname=>'Employees: Commission Report', global=>1 },
+    { rightname=>'Employees: Audit Report', global=>1 },
 
     #{ rightname => 'List customers of all agents', global=>1 },
   ],
diff --git a/FS/FS/access_right.pm b/FS/FS/access_right.pm
index 0e8bf45..d370ba5 100644
--- a/FS/FS/access_right.pm
+++ b/FS/FS/access_right.pm
@@ -229,7 +229,9 @@ sub _upgrade_data { # class method
                             'Usage: Unrateable CDRs',
                           ],
     'Provision customer service' => [ 'Edit password' ],
-
+    'Financial reports' => [ 'Employees: Commission Report',
+                             'Employees: Audit Report',
+                           ],
 ;
 
   foreach my $old_acl ( keys %onetime ) {
diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html
index 14d36c3..5689b12 100644
--- a/httemplate/elements/menu.html
+++ b/httemplate/elements/menu.html
@@ -294,9 +294,11 @@ tie my %report_ticketing, 'Tie::IxHash',
   'Advanced ticket reports' => [ $fsurl.'rt/Search/Build.html?NewQuery=1', 'List tickets by any criteria' ],
 ;
 
-tie my %report_employees, 'Tie::IxHash',
-  'Employee Commission Report' => [ $fsurl.'search/report_employee_commission.html', '' ],
-  'Employee Audit Report' => [ $fsurl.'search/report_employee_audit.html', 'Employee audit report' ],
+tie my %report_employees, 'Tie::IxHash';
+$report_employees{'Employee Commission Report'} = [ $fsurl.'search/report_employee_commission.html', '' ]
+  if $curuser->access_right('Employees: Commission Report');
+$report_employees{'Employee Audit Report'} = [ $fsurl.'search/report_employee_audit.html', 'Employee audit report' ]
+  if $curuser->access_right('Employees: Audit Report');
 ;
 
 tie my %report_bill_event, 'Tie::IxHash',
@@ -397,7 +399,7 @@ $report_menu{'Tickets'}        = [ \%report_ticketing, 'Ticket reports' ]
   if $conf->config('ticket_system')
   ;#&& FS::TicketSystem->access_right(\%session, 'Something');
 $report_menu{'Employees'}      =  [ \%report_employees, 'Employee reports'  ]
-  if $curuser->access_right('Financial reports');
+  if keys %report_employees;
 $report_menu{'Billing events'} =  [ \%report_bill_event, 'Billing events' ]
   if $curuser->access_right('Billing event reports');
 $report_menu{'Financial'}      = [ \%report_financial, 'Financial reports' ]
diff --git a/httemplate/search/employee_audit.html b/httemplate/search/employee_audit.html
index 753c7bf..2bc6ff4 100644
--- a/httemplate/search/employee_audit.html
+++ b/httemplate/search/employee_audit.html
@@ -7,7 +7,7 @@
 <%init>
 
 die "access denied"
-  unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
+  unless $FS::CurrentUser::CurrentUser->access_right('Employees: Audit Report');
 
 my %tables = (
     cust_pay        => 'Payments',
diff --git a/httemplate/search/part_pkg.html b/httemplate/search/part_pkg.html
index 2178346..a90f13c 100644
--- a/httemplate/search/part_pkg.html
+++ b/httemplate/search/part_pkg.html
@@ -23,7 +23,7 @@
 
 my $curuser = $FS::CurrentUser::CurrentUser;
 die "access denied"
-  unless $curuser->access_right('Financial reports');
+  unless $curuser->access_right('Employees: Commission Report'); #that's all this does so far
 
 my $conf = new FS::Conf;
 my $money_char = $conf->config('money_char') || '$';
diff --git a/httemplate/search/report_employee_audit.html b/httemplate/search/report_employee_audit.html
index 757b823..461849b 100644
--- a/httemplate/search/report_employee_audit.html
+++ b/httemplate/search/report_employee_audit.html
@@ -23,7 +23,7 @@
 <%init>
 
 die "access denied"
-  unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
+  unless $FS::CurrentUser::CurrentUser->access_right('Employees: Audit Report');
 
 my %tables = (
     cust_pay        => 'Payments',
diff --git a/httemplate/search/report_employee_commission.html b/httemplate/search/report_employee_commission.html
index 51afad3..ebfcae8 100644
--- a/httemplate/search/report_employee_commission.html
+++ b/httemplate/search/report_employee_commission.html
@@ -25,6 +25,6 @@
 <%init>
 
 die "access denied"
-  unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
+  unless $FS::CurrentUser::CurrentUser->access_right('Employees: Commission Report');
 
 </%init>

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

Summary of changes:
 FS/FS/AccessRight.pm                              |    2 ++
 FS/FS/access_right.pm                             |    4 +++-
 httemplate/elements/menu.html                     |   10 ++++++----
 httemplate/search/employee_audit.html             |    2 +-
 httemplate/search/part_pkg.html                   |    2 +-
 httemplate/search/report_employee_audit.html      |    2 +-
 httemplate/search/report_employee_commission.html |    2 +-
 7 files changed, 15 insertions(+), 9 deletions(-)




More information about the freeside-commits mailing list